native-dialog 0.5.4

A library to display dialogs. Supports GNU/Linux, BSD Unix, macOS and Windows.
Documentation
#[cfg(not(target_os = "macos"))]
mod resolve_tilde {
    use std::path::{Component, Path, PathBuf};

    pub fn resolve_tilde<P: AsRef<Path> + ?Sized>(path: &P) -> Option<PathBuf> {
        let mut result = PathBuf::new();

        let mut components = path.as_ref().components();
        match components.next() {
            Some(Component::Normal(c)) if c == "~" => result.push(dirs::home_dir()?),
            Some(c) => result.push(c),
            None => {}
        };
        result.extend(components);

        Some(result)
    }
}

#[cfg(not(target_os = "macos"))]
pub use resolve_tilde::resolve_tilde;