Support multiple registry path prefixes.
This commit is contained in:
@@ -43,6 +43,7 @@ namespace OpenRA
|
||||
public readonly SourceType Type = SourceType.Disc;
|
||||
|
||||
// Used to find installation locations for SourceType.Install
|
||||
public readonly string[] RegistryPrefixes = { string.Empty };
|
||||
public readonly string RegistryKey;
|
||||
public readonly string RegistryValue;
|
||||
|
||||
|
||||
@@ -481,11 +481,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
if (Platform.CurrentPlatform != PlatformType.Windows)
|
||||
return null;
|
||||
|
||||
var path = Microsoft.Win32.Registry.GetValue(source.RegistryKey, source.RegistryValue, null) as string;
|
||||
if (path == null)
|
||||
return null;
|
||||
foreach (var prefix in source.RegistryPrefixes)
|
||||
{
|
||||
var path = Microsoft.Win32.Registry.GetValue(prefix + source.RegistryKey, source.RegistryValue, null) as string;
|
||||
if (path == null)
|
||||
continue;
|
||||
|
||||
return IsValidSourcePath(path, source) ? path : null;
|
||||
return IsValidSourcePath(path, source) ? path : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (source.Type == ModContent.SourceType.Disc)
|
||||
|
||||
Reference in New Issue
Block a user