@@ -44,31 +44,34 @@ public void Init(PluginInitContext context)
44
44
context . CurrentPluginMetadata . PluginCacheDirectoryPath ,
45
45
"FaviconCache" ) ;
46
46
47
- // Start loading bookmarks asynchronously without blocking Init.
47
+ // Start loading bookmarks asynchronously without blocking Init
48
48
_ = LoadBookmarksInBackgroundAsync ( ) ;
49
49
}
50
50
51
51
private async Task LoadBookmarksInBackgroundAsync ( )
52
52
{
53
+ if ( _context . CurrentPluginMetadata . Disabled )
54
+ {
55
+ // Don't load or monitor files if disabled
56
+ return ;
57
+ }
58
+
53
59
// Prevent concurrent loading operations.
54
60
await _initializationSemaphore . WaitAsync ( ) ;
55
61
try
56
62
{
57
63
if ( _isInitialized ) return ;
58
64
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 ) ) ;
64
68
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 ) )
67
73
{
68
- if ( string . IsNullOrEmpty ( bookmark . FaviconPath ) || ! File . Exists ( bookmark . FaviconPath ) )
69
- {
70
- bookmark . FaviconPath = DefaultIconPath ;
71
- }
74
+ bookmark . FaviconPath = DefaultIconPath ;
72
75
}
73
76
}
74
77
0 commit comments