Skip to content

Commit

Permalink
Small bugfixes
Browse files Browse the repository at this point in the history
* Wait until legendary closes and then move game
* Fixes for launchable DLCs
  • Loading branch information
hawkeye116477 committed Jan 18, 2024
1 parent b3c9fc5 commit 281ff0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/LegendaryDownloadManager.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public async Task EnqueueJob(string gameID, string gameTitle, string downloadSiz
}
}

public async Task WaitUntilLegendaryCloses()
public static async Task WaitUntilLegendaryCloses()
{
if (File.Exists(Path.Combine(LegendaryLauncher.ConfigPath, "installed.json.lock")))
{
Expand Down Expand Up @@ -319,22 +319,19 @@ public async Task Install(string gameID, string gameTitle, string downloadSize,
{
var installedGameInfo = installedAppList[gameID];
Playnite.SDK.Models.Game game = new Playnite.SDK.Models.Game();
if (installedGameInfo.Is_dlc == false)
if (installedGameInfo.Is_dlc == false || !installedGameInfo.Executable.IsNullOrEmpty())
{
game = playniteAPI.Database.Games.FirstOrDefault(item => item.PluginId == LegendaryLibrary.Instance.Id && item.GameId == gameID);
}
if (!installedGameInfo.Executable.IsNullOrEmpty())
{
game.InstallDirectory = installedGameInfo.Install_path;
game.Version = installedGameInfo.Version;
game.InstallSize = (ulong?)installedGameInfo.Install_size;
game.IsInstalled = true;
}
if (installedGameInfo.Is_dlc == false)
if (installedGameInfo.Is_dlc == false || !installedGameInfo.Executable.IsNullOrEmpty())
{
playniteAPI.Database.Games.Update(game);
}
else if (!installedGameInfo.Executable.IsNullOrEmpty())
else
{
playniteAPI.Database.Games.Add(game);
}
Expand Down
1 change: 1 addition & 0 deletions src/LegendaryLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ public override IEnumerable<GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs
try
{
StopDownloadManager();
await LegendaryDownloadManager.WaitUntilLegendaryCloses();
Directory.Move(oldPath, newPath);
a.CurrentProgressValue = 1;
var rewriteResult = await Cli.Wrap(LegendaryLauncher.ClientExecPath)
Expand Down

0 comments on commit 281ff0d

Please sign in to comment.