about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2024-12-05 00:26:13 +0000
committerChris Denton <chris@chrisdenton.dev>2024-12-05 00:26:13 +0000
commitc74ede8a9c627fd19cd421202645cc3706f0ef96 (patch)
tree0978284787a2921f56fd27f9a9b4c34c2469dd1e
parentacabb5248231987ae1f0c215208d1005a5db402d (diff)
downloadrust-c74ede8a9c627fd19cd421202645cc3706f0ef96.tar.gz
rust-c74ede8a9c627fd19cd421202645cc3706f0ef96.zip
Expand home_dir docs
-rw-r--r--library/std/src/env.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/std/src/env.rs b/library/std/src/env.rs
index 043747d0bc5..535236ff89a 100644
--- a/library/std/src/env.rs
+++ b/library/std/src/env.rs
@@ -597,6 +597,13 @@ impl Error for JoinPathsError {
 
 /// Returns the path of the current user's home directory if known.
 ///
+/// This may return `None` if getting the directory fails or if the platform does not have user home directories.
+///
+/// For storing user data and configuration it is often preferable to use more specific directories.
+/// For example, [XDG Base Directories] on Unix or the `LOCALAPPDATA` and `APPDATA` environment variables on Windows.
+///
+/// [XDG Base Directories]: https://specifications.freedesktop.org/basedir-spec/latest/
+///
 /// # Unix
 ///
 /// - Returns the value of the 'HOME' environment variable if it is set