about summary refs log tree commit diff
path: root/library/std/src/env.rs
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2024-11-02 11:05:01 +0000
committerKornel <kornel@geekhood.net>2024-11-04 03:06:09 +0000
commit4b7f56ac9dd3db6163f26ab7b5e28b55756fef79 (patch)
tree2a8192897f7eec7348a0bcc3b973b23448905757 /library/std/src/env.rs
parent42188c3ca8ed84210c8cab6b1e2d553925e3dd2f (diff)
downloadrust-4b7f56ac9dd3db6163f26ab7b5e28b55756fef79.tar.gz
rust-4b7f56ac9dd3db6163f26ab7b5e28b55756fef79.zip
Fix and undeprecate home_dir()
Diffstat (limited to 'library/std/src/env.rs')
-rw-r--r--library/std/src/env.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/library/std/src/env.rs b/library/std/src/env.rs
index d732a15117e..eefae253e9b 100644
--- a/library/std/src/env.rs
+++ b/library/std/src/env.rs
@@ -608,20 +608,16 @@ impl Error for JoinPathsError {
 ///
 /// # Windows
 ///
-/// - Returns the value of the 'HOME' environment variable if it is set
-///   (including to an empty string).
-/// - Otherwise, returns the value of the 'USERPROFILE' environment variable if it is set
-///   (including to an empty string).
-/// - If both do not exist, [`GetUserProfileDirectory`][msdn] is used to return the path.
+/// - Returns the value of the 'USERPROFILE' environment variable if it is set, and is not an empty string.
+/// - Otherwise, [`GetUserProfileDirectory`][msdn] is used to return the path. This may change in the future.
 ///
 /// [msdn]: https://docs.microsoft.com/en-us/windows/win32/api/userenv/nf-userenv-getuserprofiledirectorya
 ///
-/// # Deprecation
+/// In UWP (Universal Windows Platform) targets this function is unimplemented and always returns `None`.
 ///
-/// This function is deprecated because the behavior on Windows is not correct.
-/// The 'HOME' environment variable is not standard on Windows, and may not produce
-/// desired results; for instance, under Cygwin or Mingw it will return `/home/you`
-/// when it should return `C:\Users\you`.
+/// Before Rust CURRENT_RUSTC_VERSION, this function used to return the value of the 'HOME' environment variable
+/// on Windows, which in Cygwin or Mingw environments could return non-standard paths like `/home/you`
+/// instead of `C:\Users\you`.
 ///
 /// # Examples
 ///