From 952c683d1cde21cd8f7cb9a8ce8c50abfaa0ebbc Mon Sep 17 00:00:00 2001 From: NiuBen Date: Wed, 11 Sep 2024 15:22:47 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=84=E7=90=86?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=E5=9C=A8windows=E5=A4=96=E7=9A=84?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=8D=E8=83=BD=E6=89=93=E5=BC=80=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 6148 bytes main.py | 20 +++++++++++++++++++- resource/.DS_Store | Bin 0 -> 6148 bytes 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .DS_Store create mode 100644 resource/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..63066dbb02fdd905804c353871d07efac9a61727 GIT binary patch literal 6148 zcmeHK%TB{E5FA4fk+}58(SH!}2UbbdOT|MKoGCOCNR(7fatNn1;juJUMGU+Y_6J#Py<3s1Ggy9LPR$8J+6)qBAZe>=k7evBz|xT?8T_))@nT Gz`z$1EH?B2 literal 0 HcmV?d00001 diff --git a/main.py b/main.py index a528cb6..c82d7bb 100644 --- a/main.py +++ b/main.py @@ -1,3 +1,5 @@ +import platform +import subprocess from bs4 import BeautifulSoup from tqdm import trange import util.RequestUtil as Request @@ -76,8 +78,24 @@ def save_data(): print('\033[32m' + '其他列表共有 ' + str(len(other_message)) + ' 条内容' + '\033[0m') print('\033[36m' + '图片列表共有 ' + str(len(os.listdir(pic_save_path))) + ' 张图片' + '\033[0m') current_directory = os.getcwd() - os.startfile(current_directory + user_save_path[1:]) + # os.startfile(current_directory + user_save_path[1:]) + open_file(current_directory + user_save_path[1:]) os.system('pause') + +def open_file(file_path): + # 检查操作系统 + if platform.system() == 'Windows': + # Windows 系统使用 os.startfile + os.startfile(file_path) + elif platform.system() == 'Darwin': + # macOS 系统使用 subprocess 和 open 命令 + subprocess.run(['open', file_path]) + elif platform.system() == 'Linux': + # Linux 系统使用 subprocess 和 xdg-open 命令 + subprocess.run(['xdg-open', file_path]) + else: + print(f"Unsupported OS: {platform.system()}") + if __name__ == '__main__': try: diff --git a/resource/.DS_Store b/resource/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ef32eeda7177296c54ba8b0a4c5a7d6f84c3fa40 GIT binary patch literal 6148 zcmeHK%}T>S5T4O0fr{3f$9;vq!L~&3o)?f>sfV;F)q36+>(!G7U&gb3vonHe173=h zG6TEc?EGc(L3T4l#N+jJNHid#0z;5R=@2n@x=t+k49K}gO)vFqSUoiJWk;byG|Ar2 zX+@9pOl#WS|K-K!wtwD~<)m&Vuos)J_v_8w+h{jt`e)4Y=@(B|A1Kk@$7{7()XicB zJGgam2AlzBz!`7`_QrtSD@A{A6}^x%;0zoK19CnD48dra6!X!6DYpQ?9?V&wOD`cg z!7v&oMR*{rsX$F-YcW{UVGkA;4U?j#6I=7a_T-=Dh4a%XQj{uU&*?z_5y*u2