1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Utilities to get default paths for configuration, data, and cache directories.
use ;
use ;
/// 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_DIR` is 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 |
/// 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_DIR` is 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 |
/// 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_DIR` is 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 |