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