From 4b56af8df77655686ecdd697629ca58afb5baafb Mon Sep 17 00:00:00 2001 From: Starpoles Date: Thu, 29 Jan 2026 20:40:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=9B=AE=E5=BD=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8770193..cda9873 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,8 +6,8 @@ use chrono::Local; use colored::{Color, Colorize}; use fern::Dispatch; use log::Level; -use std::env; use std::path::PathBuf; +use std::{env, fs}; #[tokio::main] async fn main() { @@ -35,7 +35,11 @@ pub fn get_current_dir() -> PathBuf { } pub fn get_log_path() -> PathBuf { - get_current_dir().join("logs") + let path = get_current_dir().join("logs"); + if !path.exists() { + fs::create_dir_all(&path).expect("创建日志目录失败"); + } + path } fn init_log() {