feat(files): 文件管理四项——侧栏拖拽移动、草稿跨窗口认领、未命名默认存根目录、打开所在位置(docs/25)

This commit is contained in:
Muse
2026-11-14 16:36:36 +08:00
parent 71825201a2
commit c2f69f9303
12 changed files with 513 additions and 19 deletions

View File

@@ -427,6 +427,21 @@ pub fn create_dir(path: String) -> Result<(), String> {
}
/// 重命名/移动文件或文件夹;目标已存在时报错。
/// 在 Windows 资源管理器中定位路径:打开父目录并选中该文件/文件夹。
/// explorer 即使成功也常以退出码 1 结束,因此只 spawn 不等结果。
#[tauri::command]
pub fn reveal_in_explorer(path: String) -> Result<(), String> {
if !Path::new(&path).exists() {
return Err("路径不存在".to_string());
}
std::process::Command::new("explorer")
.arg(format!("/select,{path}"))
.spawn()
.map_err(|e| format!("打开资源管理器失败:{e}"))?;
Ok(())
}
#[tauri::command]
#[tauri::command]
pub fn rename_path(from: String, to: String) -> Result<(), String> {
if Path::new(&to).exists() {

View File

@@ -31,6 +31,7 @@ pub fn run() {
commands::create_text_file,
commands::create_dir,
commands::rename_path,
commands::reveal_in_explorer,
commands::delete_to_trash,
commands::db_recent_list,
commands::db_recent_add,