diff options
Diffstat (limited to 'vendor/home/src/windows.rs')
-rw-r--r-- | vendor/home/src/windows.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/vendor/home/src/windows.rs b/vendor/home/src/windows.rs index 30a535df5..a35dc9c57 100644 --- a/vendor/home/src/windows.rs +++ b/vendor/home/src/windows.rs @@ -2,11 +2,9 @@ use std::env; use std::ffi::OsString; use std::os::windows::ffi::OsStringExt; use std::path::PathBuf; -use std::ptr; -use winapi::shared::minwindef::MAX_PATH; -use winapi::shared::winerror::S_OK; -use winapi::um::shlobj::{SHGetFolderPathW, CSIDL_PROFILE}; +use windows_sys::Win32::Foundation::{MAX_PATH, S_OK}; +use windows_sys::Win32::UI::Shell::{SHGetFolderPathW, CSIDL_PROFILE}; pub fn home_dir_inner() -> Option<PathBuf> { env::var_os("USERPROFILE") @@ -18,8 +16,8 @@ pub fn home_dir_inner() -> Option<PathBuf> { #[cfg(not(target_vendor = "uwp"))] fn home_dir_crt() -> Option<PathBuf> { unsafe { - let mut path: Vec<u16> = Vec::with_capacity(MAX_PATH); - match SHGetFolderPathW(ptr::null_mut(), CSIDL_PROFILE, ptr::null_mut(), 0, path.as_mut_ptr()) { + 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); |