Skip to content

Commit

Permalink
haiku: add platform support
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicah authored and Byron committed Apr 29, 2022
1 parent 18f730d commit 85f4dfd
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ use macos as os;
#[cfg(target_os = "ios")]
use ios as os;

#[cfg(target_os = "haiku")]
use haiku as os;

#[cfg(any(
target_os = "linux",
target_os = "android",
Expand All @@ -62,6 +65,7 @@ use unix as os;
target_os = "ios",
target_os = "macos",
target_os = "windows",
target_os = "haiku"
)))]
compile_error!("open is not supported on this platform");

Expand Down Expand Up @@ -315,6 +319,27 @@ mod ios {
}
}

#[cfg(target_os = "haiku")]
mod haiku {
use std::{ffi::OsStr, process::Command};

use crate::{CommandExt, IntoResult, Result};

pub fn that<T: AsRef<OsStr>>(path: T) -> Result {
Command::new("/bin/open")
.arg(path.as_ref())
.output_stderr()
.into_result()
}

pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Result {
Command::new(app.into())
.arg(path.as_ref())
.output_stderr()
.into_result()
}
}

#[cfg(any(
target_os = "linux",
target_os = "android",
Expand Down

0 comments on commit 85f4dfd

Please sign in to comment.