Skip to content

Commit d8beea5

Browse files
committed
[FlashpointInstaller] Delete files more reliably upon cancel
1 parent 056ed9c commit d8beea5

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

FlashpointInstaller/src/Forms/Operate.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,15 @@ await Task.Run(() =>
255255
{
256256
while (cancelStatus != 2) { }
257257

258-
try { Directory.Delete(FPM.DestinationPath, true); } catch { }
258+
if (Directory.Exists(FPM.DestinationPath))
259+
{
260+
foreach (string file in Directory.EnumerateFiles(FPM.DestinationPath))
261+
{
262+
try { File.Delete(file); } catch { }
263+
}
264+
265+
try { Directory.Delete(FPM.DestinationPath, true); } catch { }
266+
}
259267
});
260268

261269
TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress, FPM.Main.Handle);

0 commit comments

Comments
 (0)