From 6c0f30778f9e660b5fa43c56ffb2ce8560fdf703 Mon Sep 17 00:00:00 2001 From: xkeyC <3334969096@qq.com> Date: Thu, 21 Mar 2024 20:14:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9ASystemHelper.openDir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/helper/system_helper.dart | 2 +- lib/ui/home/localization/localization_ui_model.dart | 3 +-- lib/ui/settings/upgrade_dialog.dart | 3 +-- lib/ui/tools/tools_ui_model.dart | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/common/helper/system_helper.dart b/lib/common/helper/system_helper.dart index c23cad8..d2040ee 100644 --- a/lib/common/helper/system_helper.dart +++ b/lib/common/helper/system_helper.dart @@ -255,7 +255,7 @@ foreach ($adapter in $adapterMemory) { static Future openDir(path) async { dPrint("SystemHelper.openDir path === $path"); await Process.run( - SystemHelper.powershellPath, ["explorer.exe", "/select,\"$path\""]); + SystemHelper.powershellPath, ["explorer.exe", "/select,\"\"$path\"\""]); } static String getHostsFilePath() { diff --git a/lib/ui/home/localization/localization_ui_model.dart b/lib/ui/home/localization/localization_ui_model.dart index c12d493..939ed90 100644 --- a/lib/ui/home/localization/localization_ui_model.dart +++ b/lib/ui/home/localization/localization_ui_model.dart @@ -265,8 +265,7 @@ class LocalizationUIModel extends _$LocalizationUIModel { openDir(BuildContext context) async { showToast(context, S.current.localization_info_custom_file_instructions); - await Process.run(SystemHelper.powershellPath, - ["explorer.exe", "/select,\"${_customizeDir.absolute.path}\"\\"]); + SystemHelper.openDir("\"${_customizeDir.absolute.path}\"\\"); } VoidCallback? doRemoteInstall( diff --git a/lib/ui/settings/upgrade_dialog.dart b/lib/ui/settings/upgrade_dialog.dart index b2e512c..41eac83 100644 --- a/lib/ui/settings/upgrade_dialog.dart +++ b/lib/ui/settings/upgrade_dialog.dart @@ -259,8 +259,7 @@ class UpgradeDialogUI extends HookConsumerWidget { progress.value = 0; if (!context.mounted) return; showToast(context, S.current.app_upgrade_info_run_failed); - Process.run(SystemHelper.powershellPath, - ["explorer.exe", "/select,\"$fileName\""]); + SystemHelper.openDir("\"$fileName\""); } } } diff --git a/lib/ui/tools/tools_ui_model.dart b/lib/ui/tools/tools_ui_model.dart index d5e4bd3..c3604ce 100644 --- a/lib/ui/tools/tools_ui_model.dart +++ b/lib/ui/tools/tools_ui_model.dart @@ -361,8 +361,7 @@ class ToolsUIModel extends _$ToolsUIModel { } openDir(path) async { - await Process.run( - SystemHelper.powershellPath, ["explorer.exe", "/select,\"$path\""]); + SystemHelper.openDir("\"$path\""); } Future _showSystemInfo(BuildContext context) async {