mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-10 20:29:05 +00:00
Include code only on macOS
Co-Authored-By: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
parent
5d23aaacc8
commit
9143790602
1 changed files with 15 additions and 9 deletions
|
@ -56,19 +56,25 @@ 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();
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
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")
|
||||
.arg("-R") // To reveal in Finder instead of opening the file
|
||||
.arg(path_to_reveal.as_ref())
|
||||
.spawn()
|
||||
.log_err();
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
std::process::Command::new("open")
|
||||
.arg("-R") // To reveal in Finder instead of opening the file
|
||||
.arg(path_to_reveal.as_ref())
|
||||
.spawn()
|
||||
.log_err();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn post_inc<T: From<u8> + AddAssign<T> + Copy>(value: &mut T) -> T {
|
||||
|
|
Loading…
Reference in a new issue