Skip to content

Commit a845e68

Browse files
committed
Use plugin cache directory
1 parent b564a39 commit a845e68

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@ namespace Flow.Launcher.Plugin.BrowserBookmark;
1010

1111
public abstract class ChromiumBookmarkLoader : IBookmarkLoader
1212
{
13-
private readonly static string ClassName = nameof(ChromiumBookmarkLoader);
13+
private static readonly string ClassName = nameof(ChromiumBookmarkLoader);
1414

1515
private readonly string _faviconCacheDir;
1616

1717
protected ChromiumBookmarkLoader()
1818
{
19-
_faviconCacheDir = Path.Combine(
20-
Path.GetDirectoryName(typeof(ChromiumBookmarkLoader).Assembly.Location),
21-
"FaviconCache");
22-
Directory.CreateDirectory(_faviconCacheDir);
19+
_faviconCacheDir = Main._faviconCacheDir;
2320
}
2421

2522
public abstract List<Bookmark> GetBookmarks();

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
1515

1616
protected FirefoxBookmarkLoaderBase()
1717
{
18-
_faviconCacheDir = Path.Combine(
19-
Path.GetDirectoryName(typeof(FirefoxBookmarkLoaderBase).Assembly.Location),
20-
"FaviconCache");
21-
Directory.CreateDirectory(_faviconCacheDir);
18+
_faviconCacheDir = Main._faviconCacheDir;
2219
}
2320

2421
public abstract List<Bookmark> GetBookmarks();

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Windows.Controls;
5+
using Flow.Launcher.Infrastructure;
56
using Flow.Launcher.Plugin.BrowserBookmark.Commands;
67
using Flow.Launcher.Plugin.BrowserBookmark.Models;
78
using Flow.Launcher.Plugin.BrowserBookmark.Views;
@@ -14,6 +15,8 @@ namespace Flow.Launcher.Plugin.BrowserBookmark;
1415

1516
public class Main : ISettingProvider, IPlugin, IReloadable, IPluginI18n, IContextMenu, IDisposable
1617
{
18+
internal static string _faviconCacheDir;
19+
1720
internal static PluginInitContext _context;
1821

1922
private static List<Bookmark> _cachedBookmarks = new();
@@ -28,6 +31,12 @@ public void Init(PluginInitContext context)
2831

2932
_settings = context.API.LoadSettingJsonStorage<Settings>();
3033

34+
_faviconCacheDir = Path.Combine(
35+
_context.CurrentPluginMetadata.PluginCacheDirectoryPath,
36+
"FaviconCache");
37+
38+
Helper.ValidateDirectory(_faviconCacheDir);
39+
3140
LoadBookmarksIfEnabled();
3241
}
3342

0 commit comments

Comments
 (0)