Skip to content

Commit

Permalink
use cfg_attr
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed May 16, 2024
1 parent 75c7ea0 commit c8840af
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ pub fn that_detached<T: AsRef<OsStr>>(path: T) -> std::io::Result<()> {
(std::ptr::null(), std::ptr::null())
};


let mut info = ffi::SHELLEXECUTEINFOW {
cbSize: std::mem::size_of::<ffi::SHELLEXECUTEINFOW>() as _,
nShow: ffi::SW_SHOWNORMAL,
Expand Down Expand Up @@ -122,37 +121,8 @@ mod ffi {
pub const FOLDER: *const u16 = [102, 111, 108, 100, 101, 114, 0].as_ptr();

// Taken from https://docs.rs/windows-sys/latest/windows_sys/
#[repr(C)]
#[cfg(not(target_arch = "x86"))]
pub struct SHELLEXECUTEINFOW {
pub cbSize: u32,
pub fMask: u32,
pub hwnd: isize,
pub lpVerb: *const u16,
pub lpFile: *const u16,
pub lpParameters: *const u16,
pub lpDirectory: *const u16,
pub nShow: i32,
pub hInstApp: isize,
pub lpIDList: *mut core::ffi::c_void,
pub lpClass: *const u16,
pub hkeyClass: isize,
pub dwHotKey: u32,
pub Anonymous: SHELLEXECUTEINFOW_0,
pub hProcess: isize,
}

// Taken from https://docs.rs/windows-sys/latest/windows_sys/
#[repr(C)]
#[cfg(not(target_arch = "x86"))]
pub union SHELLEXECUTEINFOW_0 {
pub hIcon: isize,
pub hMonitor: isize,
}

// Taken from https://docs.rs/windows-sys/latest/windows_sys/
#[repr(C, packed(1))]
#[cfg(target_arch = "x86")]
#[cfg_attr(not(target_arch = "x86"), repr(C))]
#[cfg_attr(target_arch = "x86", repr(C, packed(1)))]
pub struct SHELLEXECUTEINFOW {
pub cbSize: u32,
pub fMask: u32,
Expand All @@ -172,8 +142,8 @@ mod ffi {
}

// Taken from https://docs.rs/windows-sys/latest/windows_sys/
#[repr(C, packed(1))]
#[cfg(target_arch = "x86")]
#[cfg_attr(not(target_arch = "x86"), repr(C))]
#[cfg_attr(target_arch = "x86", repr(C, packed(1)))]
pub union SHELLEXECUTEINFOW_0 {
pub hIcon: isize,
pub hMonitor: isize,
Expand Down

0 comments on commit c8840af

Please sign in to comment.