From 892b7967336b4d711cfd31be48cbd1982fcc7be3 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 23 Dec 2023 01:44:10 +0900 Subject: [PATCH] chore: load and save all properties to avoid property reordering --- vrc-get-vpm/src/environment.rs | 44 ++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/vrc-get-vpm/src/environment.rs b/vrc-get-vpm/src/environment.rs index e5ba4b91d..f5fd5479e 100644 --- a/vrc-get-vpm/src/environment.rs +++ b/vrc-get-vpm/src/environment.rs @@ -55,20 +55,54 @@ mod settings { use tokio::fs::{create_dir_all, File}; use tokio::io::AsyncWriteExt; - // TODO: restore ordering of the fields + type JsonObject = Map; + #[derive(Debug, Default, Serialize, Deserialize)] pub(crate) struct Settings { + #[serde(rename = "pathToUnityExe")] + path_to_unity_exe: String, + #[serde(rename = "pathToUnityHub")] + path_to_unity_hub: String, + #[serde(rename = "userProjects")] + user_projects: Vec, + #[serde(rename = "unityEditors")] + unity_editors: Vec, + #[serde(rename = "preferredUnityEditors")] + preferred_unity_editors: JsonObject, + #[serde(rename = "defaultProjectPath")] + default_project_path: String, + #[serde(rename = "lastUIState")] + last_uistate: i64, + #[serde(rename = "skipUnityAutoFind")] + skip_unity_auto_find: bool, #[serde(rename = "userPackageFolders")] #[serde(default)] user_package_folders: Vec, - - #[serde(flatten)] - rest: Map, - + #[serde(rename = "windowSizeData")] + window_size_data: JsonObject, + #[serde(rename = "skipRequirements")] + skip_requirements: bool, + #[serde(rename = "lastNewsUpdate")] + last_news_update: String, + #[serde(rename = "allowPii")] + allow_pii: bool, + #[serde(rename = "projectBackupPath")] + project_backup_path: String, + #[serde(rename = "showPrereleasePackages")] + show_prerelease_packages: bool, + #[serde(rename = "trackCommunityRepos")] + track_community_repos: bool, + #[serde(rename = "selectedProviders")] + selected_providers: u64, + #[serde(rename = "lastSelectedProject")] + last_selected_project: String, #[serde(rename = "userRepos")] #[serde(default)] user_repos: Vec, + #[serde(flatten)] + rest: Map, + #[serde(skip)] settings_changed: bool, }