From ccff5b822abe11d67e30badaeeab77b11238103c Mon Sep 17 00:00:00 2001 From: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:20:11 +0100 Subject: [PATCH 1/2] improve log message to include storage space reference --- Wabbajack.VFS/VirtualFile.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Wabbajack.VFS/VirtualFile.cs b/Wabbajack.VFS/VirtualFile.cs index ea2324c8..f149ddba 100644 --- a/Wabbajack.VFS/VirtualFile.cs +++ b/Wabbajack.VFS/VirtualFile.cs @@ -244,6 +244,8 @@ public class VirtualFile catch (Exception ex) { context.Logger.LogError(ex, "Error while examining the contents of {path}", relPath.FileName); + if (!ex.Message.Equals("End of stream before end of limit")) throw; + context.Logger.LogError("Possibly not enough free storage space in Wabbajack Folder Location"); throw; } From 7fd36718f53c65570c3b236990124059716a8e4a Mon Sep 17 00:00:00 2001 From: EzioTheDeadPoet <52624146+EzioTheDeadPoet@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:18:23 +0100 Subject: [PATCH 2/2] clearing temp folder when the app closes --- Wabbajack.App.Wpf/Views/MainWindow.xaml.cs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs index 4641e7dd..bb786e5d 100644 --- a/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs +++ b/Wabbajack.App.Wpf/Views/MainWindow.xaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.ObjectModel; using System.ComponentModel; +using System.IO; using System.Reactive.Linq; using System.Windows; using System.Windows.Input; @@ -47,6 +48,31 @@ namespace Wabbajack { _logger.LogInformation("Beginning shutdown..."); _mwvm.CancelRunningTasks(TimeSpan.FromSeconds(10)); + + // 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); + try + { + var directoryInfo = new DirectoryInfo(tempDirectory); + + foreach (var file in directoryInfo.EnumerateFiles()) + { + file.Delete(); + } + foreach (var dir in directoryInfo.EnumerateDirectories()) + { + dir.Delete(true); + } + + _logger.LogInformation("Finished clearing {TempDir}",tempDirectory); + } + catch (Exception ex) + { + _logger.LogDebug("Directory {TempDir} doesn't exist",tempDirectory); + } + + Application.Current.Shutdown(); };