From ce8395f6a43e3c93686ac8def4004fff50762c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 18 Oct 2024 20:49:34 +0800 Subject: [PATCH] ... --- src/retrieval.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/retrieval.py b/src/retrieval.py index 9bcd70a7..ecdb5fee 100644 --- a/src/retrieval.py +++ b/src/retrieval.py @@ -241,17 +241,14 @@ for f in collect: ff.write(bs) target = os.path.basename(targetdir) -if os.path.exists(rf"build\{target}.zip"): - os.remove(rf"build\{target}.zip") -if os.path.exists(rf"build\{target}.7z"): - os.remove(rf"build\{target}.7z") -os.system( - rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 build\{target}.zip {targetdir}' -) +os.chdir(os.path.dirname(targetdir)) +if os.path.exists(rf"{target}.zip"): + os.remove(rf"{target}.zip") +if os.path.exists(rf"{target}.7z"): + os.remove(rf"{target}.7z") +os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target}.zip {target}') if 0: - os.system( - rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA2 -mx9 build\{target}.7z {targetdir}' - ) + os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA2 -mx9 {target}.7z {target}') with open(r"C:\Program Files\7-Zip\7z.sfx", "rb") as ff: sfx = ff.read() @@ -261,10 +258,10 @@ if 0: ;!@InstallEnd@! """ - with open(rf"build\{target}.7z", "rb") as ff: + with open(rf"{target}.7z", "rb") as ff: data = ff.read() - with open(rf"build\{target}.exe", "wb") as ff: + with open(rf"{target}.exe", "wb") as ff: ff.write(sfx) ff.write(config.encode("utf8")) ff.write(data)