Skip to content

env::home_dir() should use SHGetKnownFolderPath() on windows. #28940

Closed
@Diggsey

Description

At the moment, it first looks at %HOME%, and then at %USERPROFILE%. This is bad for two reasons:

  1. The home directory will be different when run from an msys or cygwin terminal. Unless the program is specifically compiled to run in an msys/cygwin environment (they have their own target triples) then it should not be affected by %HOME% (only %USERPROFILE% stores the home directory on windows).

  2. Environment variables may be overridden. SHGetKnownFolderPath() will always give the correct path to the user's home folder.

Metadata

Assignees

No one assigned

    Labels

    C-feature-acceptedCategory: A feature request that has been accepted pending implementation.O-windowsOperating system: WindowsT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions