use std::path::PathBuf;
pub fn default_endpoint() -> PathBuf {
#[cfg(unix)]
{
PathBuf::from("/tmp/cuttlefish.sock")
}
#[cfg(windows)]
{
PathBuf::from(r"\\.\pipe\cuttlefish")
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_default_endpoint_is_absolute_and_non_empty() {
let endpoint = default_endpoint();
assert!(!endpoint.as_os_str().is_empty());
let shown = endpoint.display().to_string();
if cfg!(windows) {
assert!(
shown.starts_with(r"\\.\pipe\"),
"a Windows endpoint must name the pipe namespace: {shown}"
);
} else {
assert!(
endpoint.is_absolute(),
"a unix endpoint must not depend on the working directory: {shown}"
);
}
}
}