Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
axiangcoding committed Jun 13, 2024
1 parent 7ac00c9 commit 3d4db61
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions src-tauri/src/commands/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,7 @@ pub fn show_in_folder(path: String) {

#[cfg(target_os = "linux")]
{
if path.contains(",") {
// see https://gitlab.freedesktop.org/dbus/dbus/-/issues/76
let new_path = match metadata(&path).unwrap().is_dir() {
true => path,
false => {
let mut path2 = PathBuf::from(path);
path2.pop();
path2.into_os_string().into_string().unwrap()
}
};
Command::new("xdg-open").arg(&new_path).spawn().unwrap();
} else {
if let Ok(Fork::Child) = daemon(false, false) {
Command::new("dbus-send")
.args([
"--session",
"--dest=org.freedesktop.FileManager1",
"--type=method_call",
"/org/freedesktop/FileManager1",
"org.freedesktop.FileManager1.ShowItems",
format!("array:string:\"file://{path}\"").as_str(),
"string:\"\"",
])
.spawn()
.unwrap();
}
}
Command::new("xdg-open").args([path]).spawn().unwrap();
}

#[cfg(target_os = "macos")]
Expand Down

0 comments on commit 3d4db61

Please sign in to comment.