Skip to content

Commit

Permalink
Fix possible issues which might occur during repair
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Oct 11, 2024
1 parent 155ac43 commit c30bca2
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/LegendaryGameInstaller.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ public async Task StartTask(DownloadAction downloadAction)
{
installPath = installPath.Replace(playniteDirectoryVariable, playniteAPI.Paths.ApplicationPath);
}
if (!Helpers.IsDirectoryWritable(installPath))
if (MultiInstallData.First().downloadProperties.downloadAction == DownloadAction.Install)
{
return;
if (!Helpers.IsDirectoryWritable(installPath))
{
return;
}
}
InstallerWindow.Close();
LegendaryDownloadManager downloadManager = LegendaryLibrary.GetLegendaryDownloadManager();
Expand All @@ -89,6 +92,13 @@ public async Task StartTask(DownloadAction downloadAction)
var wantedItem = downloadManager.downloadManagerData.downloads.FirstOrDefault(item => item.gameID == gameId);
if (wantedItem == null)
{
if (downloadAction == DownloadAction.Repair)
{
var installedAppList = LegendaryLauncher.GetInstalledAppList();
var installedInfo = installedAppList[gameId];
installPath = installedInfo.Install_path;
}
installData.fullInstallPath = installPath;
var downloadProperties = GetDownloadProperties(installData, downloadAction, installPath);
installData.downloadProperties = downloadProperties;
downloadTasks.Add(installData);
Expand All @@ -101,7 +111,14 @@ public async Task StartTask(DownloadAction downloadAction)
var wantedDlc = downloadManager.downloadManagerData.downloads.FirstOrDefault(item => item.gameID == selectedDlc.Key);
if (wantedDlc == null)
{
if (downloadAction == DownloadAction.Repair)
{
var installedAppList = LegendaryLauncher.GetInstalledAppList();
var installedInfo = installedAppList[gameId];
installPath = installedInfo.Install_path;
}
var dlcInstallData = selectedDlc.Value;
dlcInstallData.fullInstallPath = installPath;
var downloadProperties = GetDownloadProperties(dlcInstallData, downloadAction, installPath);
dlcInstallData.downloadProperties = downloadProperties;
downloadTasks.Add(dlcInstallData);
Expand Down

0 comments on commit c30bca2

Please sign in to comment.