Skip to content

Commit

Permalink
Replace winapi with windows-sys
Browse files Browse the repository at this point in the history
  • Loading branch information
printfn committed Sep 9, 2023
1 parent 3b1efd3 commit 36a5253
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ toml = { version = "0.7.6", default-features = false, features = ["parse"] }
ureq = { version = "2.7.1", default-features = false, features = ["tls"] }

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["fileapi", "winnt", "errhandlingapi"] }
windows-sys = { version = "0.48.0", features = ["Win32_Foundation", "Win32_Storage_FileSystem"] }
7 changes: 4 additions & 3 deletions cli/src/file_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,10 @@ fn mark_dir_as_hidden(path: &path::Path) {
#[cfg(windows)]
#[allow(unsafe_code)]
fn mark_dir_as_hidden_impl(path: &ffi::OsStr) -> Result<(), u32> {
use std::os::windows::prelude::*;
use winapi::um::{
errhandlingapi::GetLastError, fileapi::SetFileAttributesW, winnt::FILE_ATTRIBUTE_HIDDEN,
use std::os::windows::ffi::OsStrExt;
use windows_sys::Win32::{
Foundation::GetLastError,
Storage::FileSystem::{SetFileAttributesW, FILE_ATTRIBUTE_HIDDEN},
};

let path = path.encode_wide().chain(Some(0)).collect::<Vec<u16>>();
Expand Down

0 comments on commit 36a5253

Please sign in to comment.