Installing from CD: Volume names / mount points are unreliable identifiers - check for specific files on the disk instead.

This commit is contained in:
Paul Chote
2011-07-23 16:12:08 +12:00
parent a165a80101
commit 22d3e16225
4 changed files with 18 additions and 7 deletions

View File

@@ -28,15 +28,15 @@ namespace OpenRA.FileFormats
}
}
public static string GetMountedDisk(string[] volumeNames)
public static string GetMountedDisk(Func<string, bool> isValidDisk)
{
var volumes = DriveInfo.GetDrives()
.Where(v => v.DriveType == DriveType.CDRom && v.IsReady)
.Select(v => v.RootDirectory.FullName);
return volumes.FirstOrDefault(v => volumeNames.Contains(Path.GetFileName(v)));
return volumes.FirstOrDefault(v => isValidDisk(v));
}
// TODO: The package should be mounted into its own context to avoid name collisions with installed files
public static bool ExtractFromPackage(string srcPath, string package, string[] files, string destPath, Action<string> onProgress, Action<string> onError)
{