diff --git a/switch-desktop/src/config/log_config.rs b/switch-desktop/src/config/log_config.rs index 579e966..95ee7d1 100644 --- a/switch-desktop/src/config/log_config.rs +++ b/switch-desktop/src/config/log_config.rs @@ -14,9 +14,6 @@ pub fn log_init_(file_name:&str) -> io::Result<()> { } else { return Err(io::Error::new(io::ErrorKind::Other, "not found")); }; - if !home.exists() { - std::fs::create_dir(&home)?; - } let stderr = log4rs::append::console::ConsoleAppender::builder() .target(log4rs::append::console::Target::Stderr) .build(); diff --git a/switch-desktop/src/config/mod.rs b/switch-desktop/src/config/mod.rs index c7f818d..6da8cc0 100644 --- a/switch-desktop/src/config/mod.rs +++ b/switch-desktop/src/config/mod.rs @@ -245,6 +245,9 @@ pub fn read_config() -> Option { } pub fn set_home(home: PathBuf) { + if !home.exists() { + std::fs::create_dir(&home).unwrap(); + } SWITCH_HOME_PATH.lock().replace(home); }