Fix custom VRC cache path

This commit is contained in:
Natsumi
2025-01-26 07:50:33 +13:00
parent 8b302cae20
commit e27e86373c
+18 -14
View File
@@ -21,21 +21,25 @@ namespace VRCX
public override string GetVRChatCacheLocation() public override string GetVRChatCacheLocation()
{ {
var defaultPath = Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer");
var json = ReadConfigFile(); var json = ReadConfigFile();
if (!string.IsNullOrEmpty(json)) if (string.IsNullOrEmpty(json))
{ return defaultPath;
var obj = JsonConvert.DeserializeObject<JObject>(json);
if (obj["cache_directory"] != null) var obj = JsonConvert.DeserializeObject<JObject>(json);
{ if (obj["cache_directory"] == null)
var cacheDir = (string)obj["cache_directory"]; return defaultPath;
if (!string.IsNullOrEmpty(cacheDir) && Directory.Exists(cacheDir))
{ var cacheDir = (string)obj["cache_directory"];
return cacheDir; if (string.IsNullOrEmpty(cacheDir))
} return defaultPath;
}
} var cachePath = Path.Join(cacheDir, "Cache-WindowsPlayer");
if (!Directory.Exists(cacheDir))
return Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); return defaultPath;
return cachePath;
} }
public override string GetVRChatPhotosLocation() public override string GetVRChatPhotosLocation()