mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-07-13 12:52:10 +08:00
修复同一目录下打开文件夹却打开应用程序的问题。
This commit is contained in:
parent
d51a5404ee
commit
36b77ce32b
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user