Merge pull request #3902 from dcog989/Clean-orphan-files,-temp-fix

Clean orphan files, temp fix
This commit is contained in:
Jack Ye 2025-08-16 04:35:22 +01:00 committed by GitHub
commit 4b41578024
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,6 +36,26 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex
_faviconCacheDir = Path.Combine(
context.CurrentPluginMetadata.PluginCacheDirectoryPath,
"FaviconCache");
try
{
if (Directory.Exists(_faviconCacheDir))
{
var files = Directory.GetFiles(_faviconCacheDir);
foreach (var file in files)
{
var extension = Path.GetExtension(file);
if (extension is ".db-shm" or ".db-wal" or ".sqlite-shm" or ".sqlite-wal")
{
File.Delete(file);
}
}
}
}
catch (Exception e)
{
Context.API.LogException(ClassName, "Failed to clean up orphaned cache files.", e);
}
LoadBookmarksIfEnabled();
}