Skip to content

Commit e178850

Browse files
committed
Change path to mirror both playmode and editor
1 parent f207550 commit e178850

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

Runtime/Core/Cache/CacheManager.cs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@ internal static class CacheManager
1414
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!,
1515
"cache"
1616
);
17-
*/
18-
#if UNITY_EDITOR
19-
private const string CacheDirectory = "Assets/PatchManagerCache";
20-
#else
21-
private const string CacheDirectory = "./pm_cache";
22-
#endif
17+
*/
18+
private const string CACHE_DIRECTORY = "./pm_cache";
2319

24-
private static readonly string InventoryPath = Path.Combine(CacheDirectory, "inventory.json");
20+
private static readonly string InventoryPath = Path.Combine(CACHE_DIRECTORY, "inventory.json");
2521

2622
private static readonly Dictionary<string, Archive> OpenArchives = new();
2723
public static readonly List<string> CacheValidLabels = new();
@@ -31,18 +27,18 @@ internal static class CacheManager
3127

3228
public static void CreateCacheFolderIfNotExists()
3329
{
34-
if (Directory.Exists(CacheDirectory))
30+
if (Directory.Exists(CACHE_DIRECTORY))
3531
{
3632
return;
3733
}
3834

3935
Logging.LogDebug("Cache directory does not exist, creating a new one.");
40-
Directory.CreateDirectory(CacheDirectory);
36+
Directory.CreateDirectory(CACHE_DIRECTORY);
4137
}
4238

4339
public static Archive CreateArchive(string archiveFilename)
4440
{
45-
var archivePath = Path.Combine(CacheDirectory, archiveFilename);
41+
var archivePath = Path.Combine(CACHE_DIRECTORY, archiveFilename);
4642
if (File.Exists(archivePath))
4743
{
4844
throw new ArgumentException($"Archive '{archivePath}' already exists!");
@@ -55,7 +51,7 @@ public static Archive CreateArchive(string archiveFilename)
5551

5652
public static Archive GetArchive(string archiveFilename)
5753
{
58-
var archivePath = Path.Combine(CacheDirectory, archiveFilename);
54+
var archivePath = Path.Combine(CACHE_DIRECTORY, archiveFilename);
5955
if (!File.Exists(archivePath))
6056
{
6157
throw new FileNotFoundException($"Archive '{archivePath}' does not exist!");
@@ -82,7 +78,7 @@ public static void InvalidateCache()
8278

8379
OpenArchives.Clear();
8480

85-
Directory.Delete(CacheDirectory, true);
81+
Directory.Delete(CACHE_DIRECTORY, true);
8682
CreateCacheFolderIfNotExists();
8783
}
8884

0 commit comments

Comments
 (0)