From e27e86373c8954d5d702c7ad6a519fa12cf92941 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Sun, 26 Jan 2025 07:50:33 +1300 Subject: [PATCH] Fix custom VRC cache path --- Dotnet/AppApi/Cef/Folders.cs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Dotnet/AppApi/Cef/Folders.cs b/Dotnet/AppApi/Cef/Folders.cs index 4fc76970..0ec20fba 100644 --- a/Dotnet/AppApi/Cef/Folders.cs +++ b/Dotnet/AppApi/Cef/Folders.cs @@ -21,21 +21,25 @@ namespace VRCX public override string GetVRChatCacheLocation() { + var defaultPath = Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); + var json = ReadConfigFile(); - if (!string.IsNullOrEmpty(json)) - { - var obj = JsonConvert.DeserializeObject(json); - if (obj["cache_directory"] != null) - { - var cacheDir = (string)obj["cache_directory"]; - if (!string.IsNullOrEmpty(cacheDir) && Directory.Exists(cacheDir)) - { - return cacheDir; - } - } - } - - return Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); + if (string.IsNullOrEmpty(json)) + return defaultPath; + + var obj = JsonConvert.DeserializeObject(json); + if (obj["cache_directory"] == null) + return defaultPath; + + var cacheDir = (string)obj["cache_directory"]; + if (string.IsNullOrEmpty(cacheDir)) + return defaultPath; + + var cachePath = Path.Join(cacheDir, "Cache-WindowsPlayer"); + if (!Directory.Exists(cacheDir)) + return defaultPath; + + return cachePath; } public override string GetVRChatPhotosLocation()