Skip to content

Commit

Permalink
Add ClearTempFolder button
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchLeaders committed Jun 16, 2024
1 parent 0830cb0 commit f8c015b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Tkmm/Builders/MenuModels/ShellViewMenu.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Avalonia.Controls;
using Avalonia.Controls.Notifications;
using Avalonia.Data;
using Avalonia.Markup.Xaml.Styling;
using Avalonia.Platform;
Expand Down Expand Up @@ -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()
{
Expand Down

0 comments on commit f8c015b

Please sign in to comment.