support context menu
This commit is contained in:
@@ -155,6 +155,18 @@ pub fn get_children(parent_path: String, state: &DiskState) -> Vec<FileTreeNode>
|
||||
results
|
||||
}
|
||||
|
||||
pub async fn open_explorer(path: String) -> Result<(), String> {
|
||||
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||
// 使用 /select, 参数可以在打开目录的同时选中目标
|
||||
Command::new("explorer.exe")
|
||||
.arg("/select,")
|
||||
.arg(&path)
|
||||
.creation_flags(CREATE_NO_WINDOW)
|
||||
.spawn()
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// --- 快速模式配置与逻辑 ---
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -24,6 +24,11 @@ async fn get_tree_children(path: String, state: State<'_, cleaner::DiskState>) -
|
||||
Ok(cleaner::get_children(path, &state))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn open_in_explorer(path: String) -> Result<(), String> {
|
||||
cleaner::open_explorer(path).await
|
||||
}
|
||||
|
||||
// --- 高级清理命令 ---
|
||||
|
||||
#[tauri::command]
|
||||
@@ -54,6 +59,7 @@ pub fn run() {
|
||||
start_fast_clean,
|
||||
start_full_disk_scan,
|
||||
get_tree_children,
|
||||
open_in_explorer,
|
||||
clean_system_components,
|
||||
clean_thumbnails,
|
||||
disable_hibernation
|
||||
|
||||
Reference in New Issue
Block a user