Skip to content

Commit

Permalink
feat: upgrade windows-sys to more recent version.
Browse files Browse the repository at this point in the history
This mainly reduces build times for some, and may increase them for
others, on windows only. If build times increase, try to upgrade
`windows-sys` across the dependency tree.
  • Loading branch information
Byron committed Nov 21, 2022
2 parents 2aff3bd + 4de95c7 commit c3d2819
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ doc = false
name = "open"

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.36", features = ["Win32_UI_Shell", "Win32_Foundation"] }
windows-sys = { version = "0.42", features = ["Win32_UI_Shell", "Win32_Foundation", "Win32_UI_WindowsAndMessaging"] }

[target.'cfg(all(unix, not(macos)))'.dependencies]
pathdiff = "0.2.0"
5 changes: 1 addition & 4 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::{

use std::os::raw::c_int;
use windows_sys::Win32::UI::Shell::ShellExecuteW;
use windows_sys::Win32::UI::WindowsAndMessaging::SW_SHOW;

use crate::IntoResult;

Expand All @@ -30,8 +31,6 @@ fn convert_path(path: &OsStr) -> io::Result<Vec<u16>> {
}

pub fn that<T: AsRef<OsStr>>(path: T) -> io::Result<()> {
const SW_SHOW: c_int = 5;

let path = convert_path(path.as_ref())?;
let operation: Vec<u16> = OsStr::new("open\0").encode_wide().collect();
let result = unsafe {
Expand All @@ -48,8 +47,6 @@ pub fn that<T: AsRef<OsStr>>(path: T) -> io::Result<()> {
}

pub fn with<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> io::Result<()> {
const SW_SHOW: c_int = 5;

let path = convert_path(path.as_ref())?;
let operation: Vec<u16> = OsStr::new("open\0").encode_wide().collect();
let app_name: Vec<u16> = OsStr::new(&format!("{}\0", app.into()))
Expand Down

0 comments on commit c3d2819

Please sign in to comment.