Skip to main content

tandem_server/util/
host.rs

1use tandem_types::{HostOs, HostRuntimeContext, PathStyle, ShellFamily};
2
3pub fn detect_host_runtime_context() -> HostRuntimeContext {
4    let os = if cfg!(target_os = "windows") {
5        HostOs::Windows
6    } else if cfg!(target_os = "macos") {
7        HostOs::Macos
8    } else {
9        HostOs::Linux
10    };
11    let (shell_family, path_style) = match os {
12        HostOs::Windows => (ShellFamily::Powershell, PathStyle::Windows),
13        HostOs::Linux | HostOs::Macos => (ShellFamily::Posix, PathStyle::Posix),
14    };
15    HostRuntimeContext {
16        os,
17        arch: std::env::consts::ARCH.to_string(),
18        shell_family,
19        path_style,
20    }
21}