diff --git a/Dotnet/AppApi/Cef/Folders.cs b/Dotnet/AppApi/Cef/Folders.cs index 4e4cbd7f..587f97c9 100644 --- a/Dotnet/AppApi/Cef/Folders.cs +++ b/Dotnet/AppApi/Cef/Folders.cs @@ -44,28 +44,35 @@ namespace VRCX } catch (Exception e) { - logger.Error(e); - return defaultPath; + logger.Error($"Error reading VRChat config file for cache location: {e}"); } + return defaultPath; } public override string GetVRChatPhotosLocation() { - var json = ReadConfigFile(); - if (!string.IsNullOrEmpty(json)) + var defaultPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "VRChat"); + try { - var obj = JsonConvert.DeserializeObject(json); - if (obj["picture_output_folder"] != null) - { - var photosDir = (string)obj["picture_output_folder"]; - if (!string.IsNullOrEmpty(photosDir) && Directory.Exists(photosDir)) - { - return photosDir; - } - } - } + var json = ReadConfigFile(); + if (string.IsNullOrEmpty(json)) + return defaultPath; - return Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "VRChat"); + var obj = JsonConvert.DeserializeObject(json); + if (obj["picture_output_folder"] == null) + return defaultPath; + + var photosDir = (string)obj["picture_output_folder"]; + if (string.IsNullOrEmpty(photosDir) || !Directory.Exists(photosDir)) + return defaultPath; + + return photosDir; + } + catch (Exception e) + { + logger.Error($"Error reading VRChat config file for photos location: {e}"); + } + return defaultPath; } public override string GetUGCPhotoLocation(string path = "") diff --git a/Dotnet/AppApi/Electron/Folders.cs b/Dotnet/AppApi/Electron/Folders.cs index 8f3d904d..467c2459 100644 --- a/Dotnet/AppApi/Electron/Folders.cs +++ b/Dotnet/AppApi/Electron/Folders.cs @@ -86,40 +86,58 @@ namespace VRCX public override string GetVRChatCacheLocation() { - var json = ReadConfigFile(); - if (!string.IsNullOrEmpty(json)) + var defaultPath = Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); + try { + var json = ReadConfigFile(); + if (string.IsNullOrEmpty(json)) + return defaultPath; + 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; - } - } + 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; } - - return Path.Join(GetVRChatAppDataLocation(), "Cache-WindowsPlayer"); + catch (Exception e) + { + logger.Error($"Error reading VRChat config file for cache location: {e}"); + } + return defaultPath; } public override string GetVRChatPhotosLocation() { - var json = ReadConfigFile(); - if (!string.IsNullOrEmpty(json)) + var defaultPath = Path.Join(_vrcPrefixPath, "drive_c/users/steamuser/Pictures/VRChat"); + try { + var json = ReadConfigFile(); + if (string.IsNullOrEmpty(json)) + return defaultPath; + var obj = JsonConvert.DeserializeObject(json); - if (obj["picture_output_folder"] != null) - { - var photosDir = (string)obj["picture_output_folder"]; - if (!string.IsNullOrEmpty(photosDir) && Directory.Exists(photosDir)) - { - return photosDir; - } - } + if (obj["picture_output_folder"] == null) + return defaultPath; + + var photosDir = (string)obj["picture_output_folder"]; + if (string.IsNullOrEmpty(photosDir) || !Directory.Exists(photosDir)) + return defaultPath; + + return photosDir; } - - return Path.Join(_vrcPrefixPath, "drive_c/users/steamuser/Pictures/VRChat"); + catch (Exception e) + { + logger.Error($"Error reading VRChat config file for photos location: {e}"); + } + return defaultPath; } public override string GetUGCPhotoLocation(string path = "") @@ -263,7 +281,9 @@ namespace VRCX } }; process.Start(); - return; + process.WaitForExit(); + if (process.ExitCode == 0) + return; } catch (Exception) { diff --git a/src/classes/websocket.js b/src/classes/websocket.js index 70add78f..0ae4b327 100644 --- a/src/classes/websocket.js +++ b/src/classes/websocket.js @@ -554,11 +554,16 @@ export default class extends baseClass { } else if (contentType === 'world') { // hmm } else if (contentType === 'created') { - // on avatar upload + // on avatar upload, might be gone now } else if (contentType === 'avatargallery') { // on avatar gallery image upload } else if (contentType === 'invitePhoto') { // on uploading invite photo + } else if (!contentType) { + console.log( + 'content-refresh without contentType', + content + ); } else { console.log( 'Unknown content-refresh type',