Updated GameLocation property

This commit is contained in:
erri120 2019-12-07 16:28:34 +01:00
parent ceebe0b745
commit 9d4325a5fe
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
2 changed files with 5 additions and 12 deletions

View File

@ -67,19 +67,12 @@ namespace Wabbajack.Common
public List<string> RequiredFiles { get; internal set; }
public bool Disabled { get; internal set; }
public string GameLocation
public string GameLocation(bool steam)
{
get
{
if (Consts.TestMode)
return Directory.GetCurrentDirectory();
if (Consts.TestMode)
return Directory.GetCurrentDirectory();
return (string) Registry.GetValue(GameLocationRegistryKey, "installed path", null)
??
(string) Registry.GetValue(
GameLocationRegistryKey.Replace(@"HKEY_LOCAL_MACHINE\SOFTWARE\",
@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\"), "installed path", null);
}
return steam ? SteamHandler.Instance.Games.FirstOrDefault(g => g.Game == Game)?.InstallDir : GOGHandler.Instance.Games.FirstOrDefault(g => g.Game == Game)?.Path;
}
}

View File

@ -41,7 +41,7 @@ namespace Wabbajack.Lib
var game = GameRegistry.Games[ModList.GameType];
if (GameFolder == null)
GameFolder = game.GameLocation;
GameFolder = game.GameLocation(SteamHandler.Instance.Games.Any(g => g.Game == game.Game));
if (GameFolder == null)
{