pub fn runtime_dir() -> Option<PathBuf>Expand description
Returns the first runtime directory as defined by RuntimeDirectory in the unit file.
If the environment variable RUNTIME_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 runtime_dirs.
ยงExamples
let runtime_dir = systemd_directories::runtime_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(runtime_dir) = systemd_directories::runtime_dir() {
// --snip--
}