mirror of
https://github.com/wezterm/wezterm.git
synced 2026-11-08 01:21:45 +08:00
wezterm-open-url: Replace winapi with windows-sys (#8101)
This commit is contained in:
parent
6fecdf5ae1
commit
70c036a236
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -7260,7 +7260,7 @@ dependencies = [
|
||||
name = "wezterm-open-url"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@ -6,5 +6,8 @@ publish = false
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
winapi = {workspace=true, features=["shellapi"]}
|
||||
[target."cfg(windows)".dependencies]
|
||||
windows-sys = { workspace = true, features = [
|
||||
"Win32_UI_Shell",
|
||||
"Win32_UI_WindowsAndMessaging",
|
||||
] }
|
||||
@ -57,7 +57,9 @@ pub fn open_with(url: &str, app: &str) {
|
||||
#[cfg(windows)]
|
||||
fn shell_execute(url: String, with: Option<String>) {
|
||||
use std::os::windows::ffi::OsStrExt;
|
||||
use winapi::um::shellapi::ShellExecuteW;
|
||||
use windows_sys::Win32::UI::Shell::ShellExecuteW;
|
||||
use windows_sys::Win32::UI::WindowsAndMessaging::SW_SHOW;
|
||||
|
||||
/// Convert a rust string to a windows wide string
|
||||
fn wide_string(s: &str) -> Vec<u16> {
|
||||
std::ffi::OsStr::new(s)
|
||||
@ -83,7 +85,7 @@ fn shell_execute(url: String, with: Option<String>) {
|
||||
app,
|
||||
path,
|
||||
std::ptr::null(),
|
||||
winapi::um::winuser::SW_SHOW,
|
||||
SW_SHOW,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user