From 1401ea74ddeb9ee9e009bd3ecee82deb6b83e6f4 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Wed, 27 Sep 2023 08:22:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#667=20=E7=A1=AC=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9E=81=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/system.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/utils/system.py b/app/utils/system.py index c343c194..2c4e13a9 100644 --- a/app/utils/system.py +++ b/app/utils/system.py @@ -61,7 +61,9 @@ class SystemUtils: 移动 """ try: + # 当前目录改名 temp = src.replace(src.parent / dest.name) + # 移动到目标目录 shutil.move(temp, dest) return 0, "" except Exception as err: @@ -74,7 +76,11 @@ class SystemUtils: 硬链接 """ try: - dest.hardlink_to(src) + # link到当前目录并改名 + tmp_path = src.parent / dest.name + tmp_path.hardlink_to(src) + # 移动到目标目录 + shutil.move(tmp_path, dest) return 0, "" except Exception as err: print(str(err))