Skip to content

Commit d2e63ab

Browse files
authored
Merge pull request #3535 from Flow-Launcher/temp_file_delete
Fix exception when deleting temp files
2 parents ea4360a + 4931a14 commit d2e63ab

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,17 @@ private void LoadFaviconsFromDb(string dbPath, List<Bookmark> bookmarks)
131131
}
132132
catch (Exception ex)
133133
{
134-
File.Delete(tempDbPath);
134+
try
135+
{
136+
if (File.Exists(tempDbPath))
137+
{
138+
File.Delete(tempDbPath);
139+
}
140+
}
141+
catch (Exception ex1)
142+
{
143+
Main._context.API.LogException(ClassName, $"Failed to delete temporary favicon DB: {tempDbPath}", ex1);
144+
}
135145
Main._context.API.LogException(ClassName, $"Failed to copy favicon DB: {dbPath}", ex);
136146
return;
137147
}

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public void Init(PluginInitContext context)
3737
context.CurrentPluginMetadata.PluginCacheDirectoryPath,
3838
"FaviconCache");
3939

40-
FilesFolders.ValidateDirectory(_faviconCacheDir);
41-
4240
LoadBookmarksIfEnabled();
4341
}
4442

@@ -50,6 +48,9 @@ private static void LoadBookmarksIfEnabled()
5048
return;
5149
}
5250

51+
// Validate the cache directory before loading all bookmarks because Flow needs this directory to storage favicons
52+
FilesFolders.ValidateDirectory(_faviconCacheDir);
53+
5354
_cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings);
5455
_ = MonitorRefreshQueueAsync();
5556
_initialized = true;

0 commit comments

Comments
 (0)