diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..63066db Binary files /dev/null and b/.DS_Store differ 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 0000000..ef32eed Binary files /dev/null and b/resource/.DS_Store differ