Skip to main content

load

Function load 

Source
pub fn load(config_dir: &Path, home: &Path) -> UserDirs
Expand description

Reads and parses user-dirs.dirs from the config directory, or falls back to the conventional English names under home if the file isn’t there.

The fallback is deliberately only for a missing file, not a file that exists and fails to parse in some unexpected way — a syntactically odd but present file still goes through parse, which is forgiving line-by-line (an unrecognised line is skipped, not a hard failure) rather than needing its own could-not-read/could-not-parse split the way Prefs does. There is no realistic way for this format to be “present but unparseable” as a whole, unlike a TOML file: every line either matches the one shape this parser looks for, or it doesn’t and is ignored. Performs blocking file I/O — call this off the UI thread.