Skip to content

Commit 17aab46

Browse files
committed
Check disabled flag first
1 parent 68f3f21 commit 17aab46

File tree

1 file changed

+15
-12
lines changed
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark

1 file changed

+15
-12
lines changed

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,34 @@ public void Init(PluginInitContext context)
4444
context.CurrentPluginMetadata.PluginCacheDirectoryPath,
4545
"FaviconCache");
4646

47-
// Start loading bookmarks asynchronously without blocking Init.
47+
// Start loading bookmarks asynchronously without blocking Init
4848
_ = LoadBookmarksInBackgroundAsync();
4949
}
5050

5151
private async Task LoadBookmarksInBackgroundAsync()
5252
{
53+
if (_context.CurrentPluginMetadata.Disabled)
54+
{
55+
// Don't load or monitor files if disabled
56+
return;
57+
}
58+
5359
// Prevent concurrent loading operations.
5460
await _initializationSemaphore.WaitAsync();
5561
try
5662
{
5763
if (_isInitialized) return;
5864

59-
if (!_context.CurrentPluginMetadata.Disabled)
60-
{
61-
// Validate the cache directory before loading all bookmarks because Flow needs this directory to storage favicons
62-
FilesFolders.ValidateDirectory(_faviconCacheDir);
63-
_cachedBookmarks = await Task.Run(() => BookmarkLoader.LoadAllBookmarks(_settings));
65+
// Validate the cache directory before loading all bookmarks because Flow needs this directory to storage favicons
66+
FilesFolders.ValidateDirectory(_faviconCacheDir);
67+
_cachedBookmarks = await Task.Run(() => BookmarkLoader.LoadAllBookmarks(_settings));
6468

65-
// Pre-validate all icon paths once to avoid doing it on every query.
66-
foreach (var bookmark in _cachedBookmarks)
69+
// Pre-validate all icon paths once to avoid doing it on every query
70+
foreach (var bookmark in _cachedBookmarks)
71+
{
72+
if (string.IsNullOrEmpty(bookmark.FaviconPath) || !File.Exists(bookmark.FaviconPath))
6773
{
68-
if (string.IsNullOrEmpty(bookmark.FaviconPath) || !File.Exists(bookmark.FaviconPath))
69-
{
70-
bookmark.FaviconPath = DefaultIconPath;
71-
}
74+
bookmark.FaviconPath = DefaultIconPath;
7275
}
7376
}
7477

0 commit comments

Comments
 (0)