Returns the user's home directory, cross-platform.
()
| 1009 | |
| 1010 | /// Returns the user's home directory, cross-platform. |
| 1011 | pub fn home_dir() -> Option<PathBuf> { |
| 1012 | std::env::var("HOME") |
| 1013 | .or_else(|_| std::env::var("USERPROFILE")) |
| 1014 | .ok() |
| 1015 | .map(PathBuf::from) |
| 1016 | } |
| 1017 | |
| 1018 | /// Strip `//` line comments, `/* */` block comments, and trailing commas |
| 1019 | /// before `}` / `]` from a JSONC string, then parse with `serde_json`. |
no outgoing calls