windows服务配置

This commit is contained in:
lubeilin
2023-05-28 21:29:37 +08:00
parent cf7854906f
commit 63f03fb11f
+7 -1
View File
@@ -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<u16> {
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();