From e5e16838eb2172f4953902c53609d8cc83751083 Mon Sep 17 00:00:00 2001 From: xkeyC <3334969096@qq.com> Date: Sun, 31 Mar 2024 15:53:56 +0800 Subject: [PATCH] fix: open logs --- lib/common/helper/system_helper.dart | 4 ++-- lib/ui/settings/settings_ui_model.dart | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/common/helper/system_helper.dart b/lib/common/helper/system_helper.dart index 0c74974..306ee6a 100644 --- a/lib/common/helper/system_helper.dart +++ b/lib/common/helper/system_helper.dart @@ -255,10 +255,10 @@ foreach ($adapter in $adapterMemory) { .toUpperCase(); } - static Future openDir(path) async { + static Future openDir(path, {bool isFile = false}) async { dPrint("SystemHelper.openDir path === $path"); await Process.run( - SystemHelper.powershellPath, ["explorer.exe", "/select,\"\"$path\"\""]); + SystemHelper.powershellPath, ["explorer.exe", isFile ? "/select,${path}" : "/select,\"\"$path\"\""]); } static String getHostsFilePath() { diff --git a/lib/ui/settings/settings_ui_model.dart b/lib/ui/settings/settings_ui_model.dart index 1cc72c6..907edb3 100644 --- a/lib/ui/settings/settings_ui_model.dart +++ b/lib/ui/settings/settings_ui_model.dart @@ -231,6 +231,7 @@ class SettingsUIModel extends _$SettingsUIModel { } showLogs() async { - SystemHelper.openDir(getDPrintFile()?.absolute.path.replaceAll("/", "\\")); + SystemHelper.openDir(getDPrintFile()?.absolute.path.replaceAll("/", "\\"), + isFile: true); } }