From c10b8d2ab3f8d8dd80627cf19e9ff6917f086f0a Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Fri, 2 Mar 2018 17:12:38 +0100 Subject: [PATCH 1/3] Bump scopeguard to 0.3 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 000046826a0..8336b6a6e0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ repository = "https://github.com/brson/home" license = "MIT/Apache-2.0" [target."cfg(windows)".dependencies] -scopeguard = "0.1.2" +scopeguard = "0.3" winapi = "0.2.8" kernel32-sys = "0.2.1" advapi32-sys = "0.2.0" From 1825f0a437a62593da418c1593283561eaea43e1 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Fri, 2 Mar 2018 17:19:26 +0100 Subject: [PATCH 2/3] Bump winapi to 0.3 --- Cargo.toml | 4 +--- src/lib.rs | 19 ++++++++----------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8336b6a6e0e..c6d36e0671e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,6 @@ license = "MIT/Apache-2.0" [target."cfg(windows)".dependencies] scopeguard = "0.3" -winapi = "0.2.8" -kernel32-sys = "0.2.1" -advapi32-sys = "0.2.0" +winapi = { version = "0.3", features = ["errhandlingapi", "handleapi", "processthreadsapi", "std", "winerror", "winnt"] } userenv-sys = "0.2.0" diff --git a/src/lib.rs b/src/lib.rs index 0917964b050..bdc124b22e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,14 +25,10 @@ extern crate scopeguard; #[cfg(windows)] extern crate winapi; #[cfg(windows)] -extern crate kernel32; -#[cfg(windows)] -extern crate advapi32; -#[cfg(windows)] extern crate userenv; #[cfg(windows)] -use winapi::DWORD; +use winapi::shared::minwindef::DWORD; use std::path::{PathBuf, Path}; use std::io; use std::env; @@ -72,11 +68,12 @@ pub fn home_dir() -> Option { #[cfg(windows)] fn home_dir_() -> Option { use std::ptr; - use kernel32::{GetCurrentProcess, GetLastError, CloseHandle}; - use advapi32::OpenProcessToken; use userenv::GetUserProfileDirectoryW; - use winapi::ERROR_INSUFFICIENT_BUFFER; - use winapi::winnt::TOKEN_READ; + use winapi::shared::winerror::ERROR_INSUFFICIENT_BUFFER; + use winapi::um::errhandlingapi::GetLastError; + use winapi::um::handleapi::CloseHandle; + use winapi::um::processthreadsapi::{GetCurrentProcess, OpenProcessToken}; + use winapi::um::winnt::TOKEN_READ; use scopeguard; ::std::env::var_os("USERPROFILE").map(PathBuf::from).or_else(|| unsafe { @@ -108,8 +105,8 @@ fn fill_utf16_buf(mut f1: F1, f2: F2) -> io::Result where F1: FnMut(*mut u16, DWORD) -> DWORD, F2: FnOnce(&[u16]) -> T { - use kernel32::{GetLastError, SetLastError}; - use winapi::{ERROR_INSUFFICIENT_BUFFER}; + use winapi::um::errhandlingapi::{GetLastError, SetLastError}; + use winapi::shared::winerror::ERROR_INSUFFICIENT_BUFFER; // Start off with a stack buf but then spill over to the heap if we end up // needing more space. From bfaf1f14b2e9348b9af432e84947bcb72fe3b10a Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Fri, 2 Mar 2018 17:19:36 +0100 Subject: [PATCH 3/3] Bump version number --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c6d36e0671e..411ae3b419a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "home" -version = "0.3.0" +version = "0.3.1" authors = [ "Brian Anderson " ] description = "Shared definitions of home directories" documentation = "https://docs.rs/home"