From a2180a13659019eba6a9b7c2140baee604114498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=BA=90=E7=90=83=E7=90=83=E2=9C=A8?= <1340793687@outlook.com> Date: Tue, 7 Jun 2022 10:19:23 +0000 Subject: [PATCH] fix auto update bug --- plugins/check_zhenxun_update/data_source.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/check_zhenxun_update/data_source.py b/plugins/check_zhenxun_update/data_source.py index 031db66a..8529d64c 100755 --- a/plugins/check_zhenxun_update/data_source.py +++ b/plugins/check_zhenxun_update/data_source.py @@ -162,7 +162,7 @@ def _file_handle(latest_version: str) -> str: if backup_file.exists(): backup_file.unlink() if file not in [config_file, config_path_file]: - os.rename(file.absolute(), backup_file.absolute()) + shutil.move(file.absolute(), backup_file.absolute()) else: with open(file, "r", encoding="utf8") as rf: data = rf.read() @@ -174,7 +174,7 @@ def _file_handle(latest_version: str) -> str: old_file = Path() / file if old_file not in [config_file, config_path_file] and file != "configs": if not old_file.exists() and new_file.exists(): - os.rename(new_file.absolute(), old_file.absolute()) + shutil.move(new_file.absolute(), old_file.absolute()) logger.info(f"已更新文件:{file}") # except Exception as e: # error = f'{type(e)}:{e}'