From f8c015b62f10f1e5601ef0b5f64bc10e3ad99eff Mon Sep 17 00:00:00 2001 From: ArchLeaders Date: Sat, 15 Jun 2024 20:45:41 -0700 Subject: [PATCH] Add ClearTempFolder button --- src/Tkmm/Builders/MenuModels/ShellViewMenu.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Tkmm/Builders/MenuModels/ShellViewMenu.cs b/src/Tkmm/Builders/MenuModels/ShellViewMenu.cs index 75949e7e..0164f0c1 100644 --- a/src/Tkmm/Builders/MenuModels/ShellViewMenu.cs +++ b/src/Tkmm/Builders/MenuModels/ShellViewMenu.cs @@ -1,4 +1,5 @@ using Avalonia.Controls; +using Avalonia.Controls.Notifications; using Avalonia.Data; using Avalonia.Markup.Xaml.Styling; using Avalonia.Platform; @@ -76,6 +77,21 @@ No removable disks found! } } + [Menu("Cleanup Temporary Files", "File", "Ctrl + Shift + F6", "fa-solid fa-broom-wide")] + public static void ClearTempFolder() + { + string tempFolder = Path.Combine(Path.GetTempPath(), "tkmm"); + if (!Directory.Exists(tempFolder)) { + return; + } + + Directory.Delete(tempFolder, recursive: true); + Directory.CreateDirectory(tempFolder); + App.Toast( + "The TKMM temporary files were succesfully deleted.", "Temporary Files Cleared", NotificationType.Success, TimeSpan.FromSeconds(3) + ); + } + [Menu("Exit", "File", "Alt + F4", "fa-solid fa-right-from-bracket", IsSeparator = true)] public static void Exit() {