Files
UnrealEngineUWP/Engine/Source/Programs/DotNETCommon/DotNETUtilities/ExecutingAssembly.cs
Steve Robb a1e663d053 Unification of environment variable harvesting, GetExecutingAssembly* functions, GetShortPathName and CaselessDictionary from UBT into DotNETUtilities.
Fixing up of existing code which used these facilities - this fixes the 'You are attempting to compile on a machine that does not have a supported compiler!' UAT error on machines with really long PATH variables, and exceptions in envvars with non-ASCII characters.

#codereview robert.manuszewski

[CL 2572445 by Steve Robb in Main branch]
2015-06-01 10:14:54 -04:00

33 lines
1.0 KiB
C#

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using System;
using System.IO;
namespace Tools.DotNETCommon.ExecutingAssembly
{
public static class ExecutingAssembly
{
/// <summary>
/// Gets the executing assembly path (including filename).
/// This method is using Assembly.CodeBase property to properly resolve original
/// assembly path in case shadow copying is enabled.
/// </summary>
/// <returns>Absolute path to the executing assembly including the assembly filename.</returns>
public static string GetFilename()
{
return new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath;
}
/// <summary>
/// Gets the executing assembly directory.
/// This method is using Assembly.CodeBase property to properly resolve original
/// assembly directory in case shadow copying is enabled.
/// </summary>
/// <returns>Absolute path to the directory containing the executing assembly.</returns>
public static string GetDirectory()
{
return Path.GetDirectoryName(GetFilename());
}
}
}