From 85f4dfdafe6119af5b3a5d8f079279818d3d61ee Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Fri, 15 Apr 2022 13:32:48 +1200 Subject: [PATCH] haiku: add platform support --- src/lib.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index c0941cd..6c30d7f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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", @@ -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"); @@ -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>(path: T) -> Result { + Command::new("/bin/open") + .arg(path.as_ref()) + .output_stderr() + .into_result() + } + + pub fn with>(path: T, app: impl Into) -> Result { + Command::new(app.into()) + .arg(path.as_ref()) + .output_stderr() + .into_result() + } +} + #[cfg(any( target_os = "linux", target_os = "android",