From 165e498a9450c6bb5f05a256b2e96e87564ed340 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 12 May 2025 15:12:23 +0800 Subject: [PATCH 1/2] Fix exception when deleteing temp files --- .../ChromiumBookmarkLoader.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs index 66be0890388..e859976bdc2 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs @@ -131,7 +131,17 @@ private void LoadFaviconsFromDb(string dbPath, List bookmarks) } catch (Exception ex) { - File.Delete(tempDbPath); + try + { + if (File.Exists(tempDbPath)) + { + File.Delete(tempDbPath); + } + } + catch (Exception ex1) + { + Main._context.API.LogException(ClassName, $"Failed to delete temporary favicon DB: {tempDbPath}", ex1); + } Main._context.API.LogException(ClassName, $"Failed to copy favicon DB: {dbPath}", ex); return; } From 4931a1436a5b12c99f49a596b75b13115ddf4797 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Mon, 12 May 2025 17:19:16 +0800 Subject: [PATCH 2/2] Validate the cache directory before loading all bookmarks --- Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs index 9ad31ad1401..155069495bc 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs @@ -37,8 +37,6 @@ public void Init(PluginInitContext context) context.CurrentPluginMetadata.PluginCacheDirectoryPath, "FaviconCache"); - FilesFolders.ValidateDirectory(_faviconCacheDir); - LoadBookmarksIfEnabled(); } @@ -50,6 +48,9 @@ private static void LoadBookmarksIfEnabled() return; } + // Validate the cache directory before loading all bookmarks because Flow needs this directory to storage favicons + FilesFolders.ValidateDirectory(_faviconCacheDir); + _cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings); _ = MonitorRefreshQueueAsync(); _initialized = true;