#![cfg_attr(not(target_os = "linux"), allow(dead_code))]
pub(crate) mod desktop;
pub(crate) mod gsettings_map;
pub(crate) mod kioslaverc;
pub(crate) mod sandbox;
#[cfg(target_os = "linux")]
mod backend;
#[cfg(all(target_os = "linux", feature = "linux-gnome"))]
mod gio_dl;
#[cfg(all(target_os = "linux", feature = "linux-gnome"))]
mod gnome;
#[cfg(all(target_os = "linux", feature = "linux-kde"))]
mod kde;
#[cfg(all(target_os = "linux", feature = "linux-gnome"))]
mod portal;
#[cfg(target_os = "linux")]
mod watcher;
#[cfg(target_os = "linux")]
pub(crate) use self::backend::read_config_in;
#[cfg(target_os = "linux")]
pub(crate) use self::watcher::Watch;
#[derive(Clone, Default)]
pub(crate) struct Env(std::collections::HashMap<std::ffi::OsString, std::ffi::OsString>);
impl Env {
pub(crate) fn capture() -> Self {
let mut vars = std::collections::HashMap::new();
for (name, value) in std::env::vars_os() {
vars.entry(name).or_insert(value);
}
Self(vars)
}
#[cfg(test)]
pub(crate) fn from_pairs(pairs: &[(&str, &str)]) -> Self {
Self(pairs.iter().map(|&(k, v)| (k.into(), v.into())).collect())
}
pub(crate) fn var_os(&self, name: &str) -> Option<std::ffi::OsString> {
self.0.get(std::ffi::OsStr::new(name)).cloned()
}
}