pub fn config_dir() -> Option<PathBuf>Expand description
Returns the first configuration directory as defined by ConfigurationDirectory in the unit file.
If the environment variable CONFIGURATION_DIRECTORY is not set, it returns None.
If it is set, it returns the first path in the colon-separated list.
To get all paths, use config_dirs.
ยงExamples
let config_dir = systemd_directories::config_dir().unwrap_or_default();The function returns Option<PathBuf> which can be used in if let statements to handle the case where the environment variable is not set.
if let Some(config_dir) = systemd_directories::config_dir() {
// --snip--
}