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