-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
A-homeArea: the `home` crateArea: the `home` crateO-windowsOS: WindowsOS: WindowsS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review
Description
Currently home
uses SHGetFolderPathW
to get the home directory on Windows:
cargo/crates/home/src/windows.rs
Lines 19 to 26 in bdef274
let mut path: Vec<u16> = Vec::with_capacity(MAX_PATH as usize); | |
match SHGetFolderPathW(0, CSIDL_PROFILE as i32, 0, 0, path.as_mut_ptr()) { | |
S_OK => { | |
let len = wcslen(path.as_ptr()); | |
path.set_len(len); | |
let s = OsString::from_wide(&path); | |
Some(PathBuf::from(s)) | |
} |
SHGetFolderPathW
is marked as deprecated and is simply a wrapper around SHGetKnownFolderPath
. It might be better to use the not-deprecated function.
This would allow home
to support user directories longer than MAX_PATH
if, in the future, the OS does. I do however think that's very unlikely so this change isn't that important.
Metadata
Metadata
Assignees
Labels
A-homeArea: the `home` crateArea: the `home` crateO-windowsOS: WindowsOS: WindowsS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or review