From a8aad32995d5d445ab58271c16b98c30b1bf66ef Mon Sep 17 00:00:00 2001 From: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com> Date: Mon, 8 Jan 2024 20:52:13 +0100 Subject: [PATCH] updated logging code --- Wabbajack.App.Wpf/Views/MainWindow.xaml.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs index 6f324726..2135f5c0 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs @@ -52,27 +52,26 @@ namespace Wabbajack // Cleaning the temp folder when the app closes since it can take up multiple Gigabytes of Storage var tempDirectory = Environment.CurrentDirectory + "\\temp"; _logger.LogInformation("Clearing {TempDir}",tempDirectory); + var directoryInfo = new DirectoryInfo(tempDirectory); try { - var directoryInfo = new DirectoryInfo(tempDirectory); - foreach (var file in directoryInfo.EnumerateFiles()) { - file.Delete(); + file.Delete(); } + foreach (var dir in directoryInfo.EnumerateDirectories()) { - dir.Delete(true); + dir.Delete(true); } - - _logger.LogInformation("Finished clearing {TempDir}",tempDirectory); + + _logger.LogInformation("Finished clearing {TempDir}", tempDirectory); } - catch (Exception ex) + catch (DirectoryNotFoundException) { - _logger.LogError(ex,"Failed clearing {TempDir}",tempDirectory); + _logger.LogInformation("Unable to find {TempDir}", tempDirectory); } - Application.Current.Shutdown(); };