mirror of https://github.com/Mai-with-u/MaiBot.git
Fix:配置文件不存在的时候先创建目录,否则复制文件的时候报错:FileNotFoundError: [WinError 3] 系统找不到指定的路径。
parent
42b1b772ef
commit
a3918a5aee
|
|
@ -43,6 +43,8 @@ def update_config():
|
||||||
# 检查配置文件是否存在
|
# 检查配置文件是否存在
|
||||||
if not old_config_path.exists():
|
if not old_config_path.exists():
|
||||||
logger.info("配置文件不存在,从模板创建新配置")
|
logger.info("配置文件不存在,从模板创建新配置")
|
||||||
|
#创建文件夹
|
||||||
|
old_config_dir.mkdir(parents=True, exist_ok=True)
|
||||||
shutil.copy2(template_path, old_config_path)
|
shutil.copy2(template_path, old_config_path)
|
||||||
logger.info(f"已创建新配置文件,请填写后重新运行: {old_config_path}")
|
logger.info(f"已创建新配置文件,请填写后重新运行: {old_config_path}")
|
||||||
# 如果是新创建的配置文件,直接返回
|
# 如果是新创建的配置文件,直接返回
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue