Crate systemd_directories

Source
Expand description

The systemd-directories crate is a tiny library to retrieve systemd directories following systemd.exec(5).

The library can be used in two ways:

  • As standalone functions to retrieve the directories.
  • As a struct to snapshot the environment at the time of creating SystemdDirs

§Examples

§Standalone functions

use systemd_directories;
let runtime_dir = systemd_directories::runtime_dir();

§SystemdDirs Struct

use systemd_directories::SystemdDirs;
let dirs = SystemdDirs::new();
let runtime_dir = dirs.runtime_dir();

Structs§

SystemdDirs
A struct to snapshot the environment at the time of creation.

Functions§

cache_dir
Returns the first cache directory as defined by CacheDirectory in the unit file.
cache_dirs
Returns all cache directories as defined by CacheDirectory in the unit file.
config_dir
Returns the first configuration directory as defined by ConfigurationDirectory in the unit file.
config_dirs
Returns all configuration directories as defined by ConfigurationDirectory in the unit file.
logs_dir
Returns the first logs directory as defined by LogsDirectory in the unit file.
logs_dirs
Returns all logs directories as defined by LogsDirectory in the unit file.
runtime_dir
Returns the first runtime directory as defined by RuntimeDirectory in the unit file.
runtime_dirs
Returns all runtime directories as defined by RuntimeDirectory in the unit file.
state_dir
Returns the first state directory as defined by StateDirectory in the unit file.
state_dirs
Returns all state directories as defined by StateDirectory in the unit file.