File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77"""
88
99import subprocess
10+ from pathlib import Path
11+ from typing import Union
1012
1113from ..Constants import PLATFORM , RUNTIME_INFO
1214
1315
14- def open_dir_in_explorer (dir_path : str ) -> None :
16+ def open_dir_in_explorer (dir_path : Union [ str , Path ] ) -> None :
1517 """
1618 在操作系统文件资源管理器中打开指定目录 \n
1719 :param dir_path: 待打开的目录路径
Original file line number Diff line number Diff line change 22# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license
33
44import sys
5- from subprocess import call as subprocess_call
65
76from PySide6 .QtCore import Slot
87from PySide6 .QtGui import QCloseEvent
1110from .Constants import PLATFORM , RUNTIME_INFO # noqa
1211from .Core import Packaging , PackagingTask # noqa
1312from .Resources import COMPILED_RESOURCES # noqa
13+ from .Utilities import open_dir_in_explorer # noqa
1414from .Widgets import MainWindow , SubProcessDlg # noqa
1515
1616
@@ -83,13 +83,7 @@ def handle_multifunction() -> None:
8383 self .subprocess_dlg .close ()
8484 elif btn_text == "打开输出位置" :
8585 dist_path = self .packaging_task .script_path .parent / "dist"
86- if PLATFORM .windows == RUNTIME_INFO .platform :
87- from os import startfile as os_startfile # fmt: skip
88- os_startfile (dist_path ) # noqa
89- elif PLATFORM .linux == RUNTIME_INFO .platform :
90- subprocess_call (["xdg-open" , dist_path ])
91- elif PLATFORM .macos == RUNTIME_INFO .platform :
92- subprocess_call (["open" , dist_path ])
86+ open_dir_in_explorer (dist_path )
9387 elif btn_text == "关闭" :
9488 self .subprocess_dlg .close ()
9589
You can’t perform that action at this time.
0 commit comments