Introduce an open function
And refactor some of the older code to simplify it Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
parent
a789476c95
commit
5d23aaacc8
3 changed files with 12 additions and 36 deletions
|
@ -54,6 +54,14 @@ pub fn truncate_and_trailoff(s: &str, max_chars: usize) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn open<P: AsRef<Path>>(path: P) {
|
||||
let path_to_open = path.as_ref().to_string_lossy();
|
||||
std::process::Command::new("open")
|
||||
.arg(path_to_open.as_ref())
|
||||
.spawn()
|
||||
.log_err();
|
||||
}
|
||||
|
||||
pub fn reveal_in_finder<P: AsRef<Path>>(path: P) {
|
||||
let path_to_reveal = path.as_ref().to_string_lossy();
|
||||
std::process::Command::new("open")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue