MCPcopy Create free account
hub / github.com/esengine/esengine / open_folder

Function open_folder

packages/editor-app/src-tauri/src/commands/system.rs:78–105  ·  view source on GitHub ↗
(path: String)

Source from the content-addressed store, hash-verified

76/// 在系统文件管理器中打开文件夹
77#[tauri::command]
78pub fn open_folder(path: String) -> Result<(), String> {
79 #[cfg(target_os = "windows")]
80 {
81 let normalized_path = path.replace('/', "\\");
82 Command::new("explorer")
83 .arg(&normalized_path)
84 .spawn()
85 .map_err(|e| format!("Failed to open folder: {}", e))?;
86 }
87
88 #[cfg(target_os = "macos")]
89 {
90 Command::new("open")
91 .arg(&path)
92 .spawn()
93 .map_err(|e| format!("Failed to open folder: {}", e))?;
94 }
95
96 #[cfg(target_os = "linux")]
97 {
98 Command::new("xdg-open")
99 .arg(&path)
100 .spawn()
101 .map_err(|e| format!("Failed to open folder: {}", e))?;
102 }
103
104 Ok(())
105}
106
107/// Show file in system file explorer
108#[tauri::command]

Callers

nothing calls this directly

Calls 1

spawnMethod · 0.45

Tested by

no test coverage detected