diff --git a/electron/main/item/index.ts b/electron/main/item/index.ts index e626875..a99ceb4 100644 --- a/electron/main/item/index.ts +++ b/electron/main/item/index.ts @@ -323,12 +323,14 @@ function updateOpenInfo(type: string, id: number) { */ function run( type: string, - operation: "open" | "runas" | "openFileLocation", + operation: "open" | "runas" | "openFileLocation" | "explore", item: Item ) { if (item.data) { if (operation === "open" && item.data.runAsAdmin) { operation = "runas"; + } else if (operation === "open" && item.type === 1) { + operation = "explore"; } // 更新打开信息 updateOpenInfo(type, item.id); diff --git a/rust/windows.rs b/rust/windows.rs index 98f7e78..9bff9ef 100644 --- a/rust/windows.rs +++ b/rust/windows.rs @@ -729,6 +729,8 @@ pub fn shell_execute( operation = String::from("open"); } } + // 是否是打开文件夹 + let is_dir = operation == "explore"; // dir let dir = start_location.unwrap_or_else(|| { // 判断是否是文件夹 @@ -752,8 +754,18 @@ pub fn shell_execute( let params = PCWSTR(params.as_ptr()); let dir = PCWSTR(dir.as_ptr()); unsafe { - // execute - ShellExecuteW(None, operation, file, params, dir, SW_SHOWDEFAULT); + if is_dir { + ShellExecuteW( + None, + w!("open"), + w!("explorer.exe"), + file, + None, + SW_SHOWDEFAULT, + ); + } else { + ShellExecuteW(None, operation, file, params, dir, SW_SHOWDEFAULT); + } } }); }