about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-12-09 01:56:33 +0100
committerGitHub <noreply@github.com>2024-12-09 01:56:33 +0100
commitfd7183c39d9d4428516ebb4e6be6926665c50bcf (patch)
treea61e1780f5706905b1ee97c54cf7677f482b29e6
parent38cc868e21c258a1b5539ed639e0544bbd82eb7b (diff)
parentc74ede8a9c627fd19cd421202645cc3706f0ef96 (diff)
downloadrust-fd7183c39d9d4428516ebb4e6be6926665c50bcf.tar.gz
rust-fd7183c39d9d4428516ebb4e6be6926665c50bcf.zip
Rollup merge of #133880 - ChrisDenton:homedir, r=Mark-Simulacrum
Expand home_dir docs

Since `home_dir` is set to be undeprecated, let's make the docs a bit more thorough.
-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