mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
updated logging code
This commit is contained in:
parent
e3505f4ea0
commit
a8aad32995
@ -52,27 +52,26 @@ namespace Wabbajack
|
|||||||
// Cleaning the temp folder when the app closes since it can take up multiple Gigabytes of Storage
|
// Cleaning the temp folder when the app closes since it can take up multiple Gigabytes of Storage
|
||||||
var tempDirectory = Environment.CurrentDirectory + "\\temp";
|
var tempDirectory = Environment.CurrentDirectory + "\\temp";
|
||||||
_logger.LogInformation("Clearing {TempDir}",tempDirectory);
|
_logger.LogInformation("Clearing {TempDir}",tempDirectory);
|
||||||
|
var directoryInfo = new DirectoryInfo(tempDirectory);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var directoryInfo = new DirectoryInfo(tempDirectory);
|
|
||||||
|
|
||||||
foreach (var file in directoryInfo.EnumerateFiles())
|
foreach (var file in directoryInfo.EnumerateFiles())
|
||||||
{
|
{
|
||||||
file.Delete();
|
file.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var dir in directoryInfo.EnumerateDirectories())
|
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();
|
Application.Current.Shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user