From 9cea433a8bd2fa2e487892c5aaac1393ba82db1b Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Tue, 25 Apr 2023 23:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=90=AF=E5=8A=A8=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- switch-desktop/src/config/log_config.rs | 3 --- switch-desktop/src/config/mod.rs | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) 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); }