Skip to content

Commit

Permalink
Merge branch 'logging-update-for-temp-clear-on-close' into pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
EzioTheDeadPoet committed Jan 8, 2024
2 parents 1e245e4 + a8aad32 commit 6a2189d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions Wabbajack.App.Wpf/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,26 @@ public MainWindow(ILogger<MainWindow> logger, SystemParametersConstructor system
// 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();
};

Expand Down

0 comments on commit 6a2189d

Please sign in to comment.