From dfee784545621bb4eab5a2c8b4c36f1453f01fda Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Tue, 6 Sep 2022 02:08:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6=E6=8B=B7?= =?UTF-8?q?=E8=B4=9D=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/update.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/update.py b/utils/update.py index 9932933..2942eec 100644 --- a/utils/update.py +++ b/utils/update.py @@ -50,6 +50,10 @@ def del_file(filepath): if os.path.isfile(file_path): os.remove(file_path) +def force_copy_files(from_path,to_path): + print(f'开始拷贝文件{from_path}=>{to_path}') + shutil.copytree(from_path, to_path, dirs_exist_ok=True) + def copy_to_update(): base_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) # 上级目录 tmp_path = os.path.join(base_path, f'tmp') @@ -57,10 +61,10 @@ def copy_to_update(): if not os.path.exists(dr_path): print(f'升级失败,找不到目录{dr_path}') return False - from_path = os.path.join(dr_path, f'js') - to_path = os.path.join(base_path, f'js') - print(f'开始拷贝文件{from_path}=>{to_path}') - shutil.copytree(from_path, to_path) + force_copy_files(os.path.join(dr_path, f'js'),os.path.join(base_path, f'js')) + force_copy_files(os.path.join(dr_path, f'classes'),os.path.join(base_path, f'classes')) + force_copy_files(os.path.join(dr_path, f'templates'),os.path.join(base_path, f'templates')) + force_copy_files(os.path.join(dr_path, f'utils'),os.path.join(base_path, f'utils')) return True def download_new_version(): -- GitLab