diff --git a/src/Bundle/Sucrose.Bundle/Main.xaml.cs b/src/Bundle/Sucrose.Bundle/Main.xaml.cs index 61957e0f0..168b82896 100644 --- a/src/Bundle/Sucrose.Bundle/Main.xaml.cs +++ b/src/Bundle/Sucrose.Bundle/Main.xaml.cs @@ -194,7 +194,7 @@ private static async Task ControlDirectoryStable(string Location) { try { - Directory.Delete(Record, true); + Directory.Delete(Record); } catch { } } @@ -202,7 +202,7 @@ private static async Task ControlDirectoryStable(string Location) { try { - Directory.Delete(Record, true); + Directory.Delete(Record); } catch { } } diff --git a/src/Project/Sucrose.Undo/App.xaml.cs b/src/Project/Sucrose.Undo/App.xaml.cs index 8dc9519e4..f9c29f362 100644 --- a/src/Project/Sucrose.Undo/App.xaml.cs +++ b/src/Project/Sucrose.Undo/App.xaml.cs @@ -43,37 +43,51 @@ private static void DeleteDirectory(string Location) { string[] Files = Directory.GetFiles(Location, "*", SearchOption.AllDirectories); - foreach (string Record in Files) + if (Files.Any()) { - if (Path.GetFileName(Record) == TemporaryFile) + foreach (string Record in Files) { - try + if (Path.GetFileName(Record) == TemporaryFile) { - File.Delete(Record); + try + { + File.Delete(Record); + } + catch { } + } + else + { + try + { + File.Delete(Record); + } + catch { } } - catch { } - } - else - { - File.Delete(Record); } } string[] Folders = Directory.GetDirectories(Location); - foreach (string Record in Folders) + if (Folders.Any()) { - if (Path.GetFileName(Record) == TemporaryFolder) + foreach (string Record in Folders) { - try + if (Path.GetFileName(Record) == TemporaryFolder) { - Directory.Delete(Record); + try + { + Directory.Delete(Record); + } + catch { } + } + else + { + try + { + Directory.Delete(Record); + } + catch { } } - catch { } - } - else - { - Directory.Delete(Record, true); } }