From 63f03fb11f03d6445a16b21a84cb8bb78b42ce55 Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Sun, 28 May 2023 21:29:37 +0800 Subject: [PATCH] =?UTF-8?q?windows=E6=9C=8D=E5=8A=A1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- switch-desktop/src/config/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/switch-desktop/src/config/mod.rs b/switch-desktop/src/config/mod.rs index e9b7237..f91ab37 100644 --- a/switch-desktop/src/config/mod.rs +++ b/switch-desktop/src/config/mod.rs @@ -21,7 +21,7 @@ pub fn get_win_server_home() -> PathBuf { } #[cfg(windows)] -pub fn set_win_server_home(home:PathBuf) { +pub fn set_win_server_home(home: PathBuf) { let _ = SWITCH_HOME_PATH.lock().insert(home); } @@ -405,6 +405,12 @@ pub fn read_command_port() -> io::Result { pub fn get_home() -> PathBuf { + #[cfg(windows)] + { + if let Some(path) = SWITCH_HOME_PATH.lock().as_ref() { + return path.clone(); + } + } let home = dirs::home_dir().unwrap().join(".switch_desktop"); if !home.exists() { std::fs::create_dir(&home).unwrap();