pub fn config_root(bin: &'static str) -> Result<PathBuf>Available on crate feature
config only.Expand description
Returns the path to the user’s config directory for the given binary.
This is determined by the following steps:
- If the environment variable
<BIN>_CONFIG_DIRis set, return that. - If the operating environment provides a config directory, return
$CONFIG_DIR/<bin>. - Otherwise, return an error.
The default directories are as follows:
| Platform | Value | Example |
|---|---|---|
| Linux | $XDG_CONFIG_HOME or $HOME/.config/iroh | /home/alice/.config/iroh |
| macOS | $HOME/Library/Application Support/iroh | /Users/Alice/Library/Application Support/iroh |
| Windows | {FOLDERID_RoamingAppData}/iroh | C:\Users\Alice\AppData\Roaming\iroh |