Skip to content

Commit 68fc103

Browse files
committed
Use trick to get the cache directory path
1 parent 1b05643 commit 68fc103

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
</ItemGroup>
5959

6060
<ItemGroup>
61-
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
6261
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
6362
</ItemGroup>
6463

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Threading;
77
using System.Threading.Tasks;
88
using System.Windows.Controls;
9-
using Flow.Launcher.Infrastructure.UserSettings;
109
using Flow.Launcher.Plugin.Program.Programs;
1110
using Flow.Launcher.Plugin.Program.Views;
1211
using Flow.Launcher.Plugin.Program.Views.Models;
@@ -234,11 +233,17 @@ static void MoveFile(string sourcePath, string destinationPath)
234233
}
235234
}
236235

236+
// If plugin cache directory is this: D:\\Data\\Cache\\Plugins\\Flow.Launcher.Plugin.Program
237+
// then the parent directory is: D:\\Data\\Cache
238+
// So we can use the parent of the parent directory to get the cache directory path
239+
var directoryInfo = new DirectoryInfo(pluginCacheDirectory);
240+
var cacheDirectory = directoryInfo.Parent.Parent.FullName;
241+
237242
// Move old cache files to the new cache directory
238-
var oldWin32CacheFile = Path.Combine(DataLocation.CacheDirectory, $"{Win32CacheName}.cache");
243+
var oldWin32CacheFile = Path.Combine(cacheDirectory, $"{Win32CacheName}.cache");
239244
var newWin32CacheFile = Path.Combine(pluginCacheDirectory, $"{Win32CacheName}.cache");
240245
MoveFile(oldWin32CacheFile, newWin32CacheFile);
241-
var oldUWPCacheFile = Path.Combine(DataLocation.CacheDirectory, $"{UwpCacheName}.cache");
246+
var oldUWPCacheFile = Path.Combine(cacheDirectory, $"{UwpCacheName}.cache");
242247
var newUWPCacheFile = Path.Combine(pluginCacheDirectory, $"{UwpCacheName}.cache");
243248
MoveFile(oldUWPCacheFile, newUWPCacheFile);
244249

0 commit comments

Comments
 (0)