提交 4fb863e9 编写于 作者: T Tom Meschter

Fix up `AssemblyUtilities` to use `PortableShim`.

上级 ecec6d48
...@@ -58,7 +58,7 @@ public static ImmutableArray<string> FindAssemblySet(string filePath) ...@@ -58,7 +58,7 @@ public static ImmutableArray<string> FindAssemblySet(string filePath)
string referencePath = Path.Combine(directory, referenceName + ".dll"); string referencePath = Path.Combine(directory, referenceName + ".dll");
if (!assemblySet.Contains(referencePath) && if (!assemblySet.Contains(referencePath) &&
File.Exists(referencePath)) PortableShim.File.Exists(referencePath))
{ {
workList.Enqueue(referencePath); workList.Enqueue(referencePath);
} }
...@@ -108,16 +108,16 @@ public static ImmutableArray<string> FindSatelliteAssemblies(string filePath) ...@@ -108,16 +108,16 @@ public static ImmutableArray<string> FindSatelliteAssemblies(string filePath)
string resourcesNameWithoutExtension = fileNameWithoutExtension + ".resources"; string resourcesNameWithoutExtension = fileNameWithoutExtension + ".resources";
string resourcesNameWithExtension = resourcesNameWithoutExtension + ".dll"; string resourcesNameWithExtension = resourcesNameWithoutExtension + ".dll";
foreach (var subDirectory in Directory.EnumerateDirectories(directory)) foreach (var subDirectory in PortableShim.Directory.EnumerateDirectories(directory, "*", PortableShim.SearchOption.TopDirectoryOnly))
{ {
string satelliteAssemblyPath = Path.Combine(subDirectory, resourcesNameWithExtension); string satelliteAssemblyPath = Path.Combine(subDirectory, resourcesNameWithExtension);
if (File.Exists(satelliteAssemblyPath)) if (PortableShim.File.Exists(satelliteAssemblyPath))
{ {
builder.Add(satelliteAssemblyPath); builder.Add(satelliteAssemblyPath);
} }
satelliteAssemblyPath = Path.Combine(subDirectory, resourcesNameWithoutExtension, resourcesNameWithExtension); satelliteAssemblyPath = Path.Combine(subDirectory, resourcesNameWithoutExtension, resourcesNameWithExtension);
if (File.Exists(satelliteAssemblyPath)) if (PortableShim.File.Exists(satelliteAssemblyPath))
{ {
builder.Add(satelliteAssemblyPath); builder.Add(satelliteAssemblyPath);
} }
......
...@@ -188,10 +188,19 @@ internal static class Directory ...@@ -188,10 +188,19 @@ internal static class Directory
contractName: $"{TypeName}, {System_IO_FileSystem_Name}", contractName: $"{TypeName}, {System_IO_FileSystem_Name}",
desktopName: TypeName); desktopName: TypeName);
private static readonly MethodInfo s_enumerateDirectories = Type
.GetTypeInfo()
.GetDeclaredMethod(nameof(EnumerateDirectories), new[] { typeof(string), typeof(string), SearchOption.Type });
private static readonly MethodInfo s_enumerateFiles = Type private static readonly MethodInfo s_enumerateFiles = Type
.GetTypeInfo() .GetTypeInfo()
.GetDeclaredMethod(nameof(EnumerateFiles), new[] { typeof(string), typeof(string), SearchOption.Type }); .GetDeclaredMethod(nameof(EnumerateFiles), new[] { typeof(string), typeof(string), SearchOption.Type });
internal static IEnumerable<string> EnumerateDirectories(string path, string searchPattern, object searchOption)
{
return (IEnumerable<string>)s_enumerateDirectories.Invoke(null, new object[] { path, searchPattern, searchOption });
}
internal static IEnumerable<string> EnumerateFiles(string path, string searchPattern, object searchOption) internal static IEnumerable<string> EnumerateFiles(string path, string searchPattern, object searchOption)
{ {
return (IEnumerable<string>)s_enumerateFiles.Invoke(null, new object[] { path, searchPattern, searchOption }); return (IEnumerable<string>)s_enumerateFiles.Invoke(null, new object[] { path, searchPattern, searchOption });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册