diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs index 39bbb73ff..282876472 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs @@ -10,16 +10,13 @@ namespace Flow.Launcher.Plugin.BrowserBookmark; public abstract class ChromiumBookmarkLoader : IBookmarkLoader { - private readonly static string ClassName = nameof(ChromiumBookmarkLoader); + private static readonly string ClassName = nameof(ChromiumBookmarkLoader); private readonly string _faviconCacheDir; protected ChromiumBookmarkLoader() { - _faviconCacheDir = Path.Combine( - Path.GetDirectoryName(typeof(ChromiumBookmarkLoader).Assembly.Location), - "FaviconCache"); - Directory.CreateDirectory(_faviconCacheDir); + _faviconCacheDir = Main._faviconCacheDir; } public abstract List GetBookmarks(); diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs index 0e02b2c9e..d2f973329 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs @@ -15,10 +15,7 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader protected FirefoxBookmarkLoaderBase() { - _faviconCacheDir = Path.Combine( - Path.GetDirectoryName(typeof(FirefoxBookmarkLoaderBase).Assembly.Location), - "FaviconCache"); - Directory.CreateDirectory(_faviconCacheDir); + _faviconCacheDir = Main._faviconCacheDir; } public abstract List GetBookmarks(); diff --git a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs index 5ab868ab9..5dec8b953 100644 --- a/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Controls; +using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin.BrowserBookmark.Commands; using Flow.Launcher.Plugin.BrowserBookmark.Models; using Flow.Launcher.Plugin.BrowserBookmark.Views; @@ -14,6 +15,8 @@ namespace Flow.Launcher.Plugin.BrowserBookmark; public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContextMenu, IDisposable { + internal static string _faviconCacheDir; + internal static PluginInitContext _context; private static List _cachedBookmarks = new(); @@ -28,6 +31,12 @@ public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContex _settings = context.API.LoadSettingJsonStorage(); + _faviconCacheDir = Path.Combine( + _context.CurrentPluginMetadata.PluginCacheDirectoryPath, + "FaviconCache"); + + Helper.ValidateDirectory(_faviconCacheDir); + LoadBookmarksIfEnabled(); }