Error when finding the game with no path

This commit is contained in:
erri120 2021-07-16 14:10:46 +02:00
parent 4f4d8c487b
commit d64afea6ab
No known key found for this signature in database
GPG Key ID: 7FA9556C936B847C
2 changed files with 11 additions and 4 deletions

View File

@ -40,7 +40,7 @@ namespace Wabbajack.Common.StoreHandlers
foreach (var game in handler.Games)
{
Utils.Log($"{handler.StoreType}: Found game {game}");
Utils.Log($"{handler.StoreType}: Found game {game} at \"{game.Path}\"");
_storeGames.Add(game);
}
}
@ -86,9 +86,10 @@ namespace Wabbajack.Common.StoreHandlers
public AbsolutePath? TryGetGamePath(Game game)
{
if (Games.TryGetValue(game, out var storeGame))
return (AbsolutePath) storeGame.Path;
return null;
if (!Games.TryGetValue(game, out var storeGame))
return null;
return (AbsolutePath)storeGame.Path;
}
public static void Warmup()

View File

@ -65,6 +65,12 @@ namespace Wabbajack.Lib
if (GameFolder == null)
GameFolder = Game.TryGetGameLocation();
if (GameFolder is { Exists: false })
{
Utils.Error($"Located game {Game.HumanFriendlyGameName} at \"{GameFolder.Value}\" but the folder does not exist!");
return false;
}
if (GameFolder == null)
{
var otherGame = Game.CommonlyConfusedWith.Where(g => g.MetaData().IsInstalled).Select(g => g.MetaData()).FirstOrDefault();