Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@
{
try
{
dir.Delete(true);
// Log folders are the last level of folders
dir.Delete(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you show the parameter name so we know what option is set to false.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

}
catch (Exception e)
{
Expand Down Expand Up @@ -214,6 +215,7 @@
{
var success = true;
var cacheDirectory = GetCacheDir();
var pluginCacheDirectory = GetPluginCacheDir();
var cacheFiles = GetCacheFiles();

cacheFiles.ForEach(f =>
Expand All @@ -229,12 +231,14 @@
}
});

cacheDirectory.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)
// Firstly, delete plugin cache directories
pluginCacheDirectory.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)
.ToList()
.ForEach(dir =>
{
try
{
// Plugin may create directories in its cache directory
dir.Delete(true);
}
catch (Exception e)
Expand All @@ -244,6 +248,18 @@
}
});

// Then, delete plugin directory
try
{
// Log folders are the last level of folders
GetPluginCacheDir().Delete(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here please

}
catch (Exception e)
{
App.API.LogException(ClassName, $"Failed to delete cache directory: {dir.Name}", e);

Check failure on line 259 in Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

View workflow job for this annotation

GitHub Actions / build

The name 'dir' does not exist in the current context

Check failure on line 259 in Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs

View workflow job for this annotation

GitHub Actions / build

The name 'dir' does not exist in the current context
success = false;
}

OnPropertyChanged(nameof(CacheFolderSize));

return success;
Expand All @@ -254,6 +270,11 @@
return new DirectoryInfo(DataLocation.CacheDirectory);
}

private static DirectoryInfo GetPluginCacheDir()
{
return new DirectoryInfo(DataLocation.PluginCacheDirectory);
}

private static List<FileInfo> GetCacheFiles()
{
return GetCacheDir().EnumerateFiles("*", SearchOption.AllDirectories).ToList();
Expand Down
Loading