MCPcopy Create free account
hub / github.com/PerroEngine/Perro / data_local_dir

Function data_local_dir

perro_source/io_stack/perro_io/src/dirs.rs:30–47  ·  view source on GitHub ↗

Get the user's local data directory (non-roaming on Windows) - Windows: `{FOLDERID_LocalAppData}` e.g. `C:\Users\Alice\AppData\Local` - macOS: `$HOME/Library/Application Support` e.g. `/Users/Alice/Library/Application Support` - Linux: `$XDG_DATA_HOME` or `$HOME/.local/share` e.g. `/home/alice/.local/share`

()

Source from the content-addressed store, hash-verified

28/// - macOS: `$HOME/Library/Application Support` e.g. `/Users/Alice/Library/Application Support`
29/// - Linux: `$XDG_DATA_HOME` or `$HOME/.local/share` e.g. `/home/alice/.local/share`
30pub fn data_local_dir() -> Option<PathBuf> {
31 #[cfg(target_os = "windows")]
32 {
33 std::env::var_os("LOCALAPPDATA").map(PathBuf::from)
34 }
35
36 #[cfg(target_os = "macos")]
37 {
38 std::env::var_os("HOME").map(|h| PathBuf::from(h).join("Library/Application Support"))
39 }
40
41 #[cfg(not(any(target_os = "windows", target_os = "macos")))]
42 {
43 std::env::var_os("XDG_DATA_HOME")
44 .map(PathBuf::from)
45 .or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".local/share")))
46 }
47}
48
49/// Get the user's config directory
50/// - Windows: `{FOLDERID_RoamingAppData}` e.g. `C:\Users\Alice\AppData\Roaming`

Callers 3

resolve_pathFunction · 0.85
calibration_pathFunction · 0.85
reload_dlc_mountsMethod · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected