Fix installing addons post-installation, was using wrong base folder

This commit is contained in:
RattleSN4K3 2025-05-15 02:40:34 +02:00
parent 2053f359bf
commit fa2919b81b

View file

@ -917,9 +917,18 @@ namespace LANCommander.SDK.Services
if ((game.Type == GameType.Expansion || game.Type == GameType.Mod || game.Type == GameType.StandaloneMod) && game.BaseGameId != Guid.Empty)
{
var baseGame = await Client.Games.GetAsync(game.BaseGameId);
// modify installation passes the original installation of the game including the game folder, use the existing folder,
// otherwise a name change could lead to installing files into differnt folder
if (Path.Exists(installDirectory) && Path.Exists(Path.Combine(installDirectory, ".lancommander")))
{
return installDirectory;
}
else
{
var baseGame = await Client.Games.GetAsync(game.BaseGameId);
return await GetInstallDirectory(baseGame, installDirectory);
return await GetInstallDirectory(baseGame, installDirectory);
}
}
else
return Path.Combine(installDirectory, game.Title.SanitizeFilename());