dirs
Index
Functions
fn cache(prog: str) str;
fn config(prog: str) str;
fn data(prog: str) str;
fn runtime() (str | fs::error);
fn state(prog: str) str;
Functions
fn cache
fn cache(prog: str) str;
Returns a directory suitable for cache files. The "prog" parameter should be a descriptive name unique to this program. The return value is statically allocated and will be overwritten on subsequent calls to any function in the dirs module.
fn config
fn config(prog: str) str;
Returns a directory suitable for storing config files. The "prog" parameter should be a descriptive name unique to this program. The return value is statically allocated and will be overwritten on subsequent calls to any function in the dirs module.
fn data
fn data(prog: str) str;
Returns a directory suitable for persistent data files. The "prog" parameter should be a descriptive name unique to this program. The return value is statically allocated and will be overwritten on subsequent calls to any function in the dirs module.
fn runtime
fn runtime() (str | fs::error);
Returns a directory suitable for storing non-essential runtime files and other file objects (such as sockets, named pipes, and so on). Applications should use this directory for communication and synchronization purposes and should not place larger files in it, since it might reside in runtime memory and cannot necessarily be swapped out to disk.
The specification requires the directory to be owned by the current user and not be world-readable. No fallback is implemented in case XDG_RUNTIME_DIR is unset or incorrectly set up.
fn state
fn state(prog: str) str;
Returns a directory suitable for storing program state data. The "prog" parameter should be a descriptive name unique to this program. The return value is statically allocated and will be overwritten on subsequent calls to any function in the dirs module.