Microsoft.Cci.MetadataHostEnvironment.GetLocalPath C# (CSharp) Method

GetLocalPath() public static method

Returns the CodeBase of the named assembly (which is a URL), except if the URL has the file scheme. In that case the URL is converted to a local file path that can be used by System.IO.Path methods.
public static GetLocalPath ( System assemblyName ) : string
assemblyName System The name of the assembly whose location is desired.
return string
    public static string GetLocalPath(System.Reflection.AssemblyName assemblyName) {
      Contract.Requires(assemblyName != null);

      var loc = assemblyName.CodeBase;
      if (loc == null) loc = "";
      if (loc.StartsWith("file://", StringComparison.OrdinalIgnoreCase)) {
        Uri u = new Uri(loc, UriKind.Absolute);
        loc = u.LocalPath;
      }
      return loc;
    }