Delete install path on install error

This commit is contained in:
Daniel 2023-04-08 15:47:01 -05:00
parent cb770f8dab
commit f05005460f

View file

@ -101,6 +101,8 @@ namespace LANCommander.PlaynitePlugin
var destination = Path.Combine(Plugin.Settings.InstallDirectory, game.Title.SanitizeFilename());
Plugin.PlayniteApi.Dialogs.ActivateGlobalProgress(progress =>
{
try
{
Directory.CreateDirectory(destination);
progress.ProgressMaxValue = 100;
@ -122,6 +124,14 @@ namespace LANCommander.PlaynitePlugin
Overwrite = true
});
}
}
catch (Exception ex)
{
if (Directory.Exists(destination))
{
Directory.Delete(destination, true);
}
}
},
new GlobalProgressOptions($"Downloading {game.Title}...")
{