diff --git a/launcher/webview/api.py b/launcher/webview/api.py index 5842e9f..227f82e 100644 --- a/launcher/webview/api.py +++ b/launcher/webview/api.py @@ -43,7 +43,6 @@ command_list = { "pip_tools_install": lambda: f"..\\python\\Scripts\\pip install --no-cache-dir -i {mirror_list[config.conf.mirror]} pip-tools --no-warn-script-location", "pip_sync": lambda: f"..\\python\\Scripts\\pip-sync -i {mirror_list[config.conf.mirror]} requirements.txt", "webview": lambda instance_path="": f'..\\python\\pythonw -X utf8 webview_ui.py "{instance_path}"', - "open_folder": lambda folder_path: f"explorer {folder_path}", } @@ -252,3 +251,10 @@ class Api: def migrate_instances_config(self): """迁移多开配置""" return manager.migrate_instances_config() + + def open_folder(self, path): + if not os.path.exists(path): + custom_event(LogType.error, f"路径不存在:{path}") + else: + os.startfile(path) + custom_event(LogType.info, f"成功打开文件夹:{path}") diff --git a/ui/src/pages/Launch.vue b/ui/src/pages/Launch.vue index 3c15f37..faaacff 100644 --- a/ui/src/pages/Launch.vue +++ b/ui/src/pages/Launch.vue @@ -62,7 +62,7 @@ function end_update_instance_name() { update_instance_name_index.value = null } function open_folder(path) { - pywebview.api.run('open_folder', null, { folder_path: path }) + pywebview.api.open_folder(path) } function start_instance(instance) { pywebview.api.run('webview', 'mower-ng', {