Work around incorrect mono behaviour under OSX.

This commit is contained in:
Paul Chote
2016-09-14 21:48:40 +01:00
parent 634faa31de
commit aab91cb37e

View File

@@ -96,6 +96,18 @@ namespace OpenRA.Mods.Common.Widgets.Logic
DetectContentDisks(); DetectContentDisks();
} }
static bool IsValidDrive(DriveInfo d)
{
if (d.DriveType == DriveType.CDRom && d.IsReady)
return true;
// HACK: the "TFD" DVD is detected as a fixed udf-formatted drive on OSX
if (d.DriveType == DriveType.Fixed && d.DriveFormat == "udf")
return true;
return false;
}
void DetectContentDisks() void DetectContentDisks()
{ {
var message = "Detecting drives"; var message = "Detecting drives";
@@ -105,7 +117,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
new Task(() => new Task(() =>
{ {
var volumes = DriveInfo.GetDrives() var volumes = DriveInfo.GetDrives()
.Where(v => v.DriveType == DriveType.CDRom && v.IsReady) .Where(IsValidDrive)
.Select(v => v.RootDirectory.FullName); .Select(v => v.RootDirectory.FullName);
foreach (var kv in sources) foreach (var kv in sources)