Skip to content

Commit

Permalink
fix: open std program
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonThormeyer committed Oct 22, 2023
1 parent 9ed9547 commit 126c321
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions litt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,25 @@ Using standard system PDF viewer... {}", path.to_string()
}

fn open_std_programm(path: String) -> Result<(), LittError> {
println!("Using `that_in_background`: {}", path);
open::that_in_background(&path);
println!("Done");
// #[cfg(unix)]
// std::process::Command::new("open")
// .arg(&path)
// .spawn()
// .map_err(|e| LittError(e.to_string()))?;
#[cfg(target_os = "macos")]
std::process::Command::new("open")
.arg(&path)
.spawn()
.map_err(|e| LittError(e.to_string()))?;

#[cfg(target_os = "linux")]
std::process::Command::new("xdg-open")
.arg(&path)
.spawn()
.map_err(|e| LittError(e.to_string()))?;

// #[cfg(windows)]
// std::process::Command::new("cmd")
// .arg("/c")
// .arg("start")
// .arg(&path.0)
// .spawn()
// .map_err(|e| LittError(e.to_string()))?;
#[cfg(windows)]
std::process::Command::new("cmd")
.arg("/c")
.arg("start")
.arg(&path.0)
.spawn()
.map_err(|e| LittError(e.to_string()))?;

Ok(())
}
Expand Down

0 comments on commit 126c321

Please sign in to comment.