Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace windows with windows-sys #118

Merged
merged 3 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "[Ubuntu] install dependencies"
PolyMeilex marked this conversation as resolved.
Show resolved Hide resolved
if: matrix.name == 'Ubuntu GTK'
run: sudo apt update && sudo apt install libgtk-3-dev
- name: "[WASM] rustup"
if: matrix.name == 'WASM32'
run: rustup target add wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
- name: Build
PolyMeilex marked this conversation as resolved.
Show resolved Hide resolved
run: cargo build --target ${{ matrix.target }} ${{ matrix.flags }}
- name: Test
Expand Down
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default = ["gtk3"]
file-handle-inner = []
gtk3 = ["gtk-sys", "glib-sys", "gobject-sys"]
xdg-portal = ["ashpd", "urlencoding", "pollster"]
common-controls-v6 = ["windows/Win32_UI_Controls"]
common-controls-v6 = ["windows-sys/Win32_UI_Controls"]

[dev-dependencies]
futures = "0.3.12"
Expand All @@ -32,7 +32,7 @@ block = "0.1.6"
objc-foundation = "0.1.1"

[target.'cfg(target_os = "windows")'.dependencies]
windows = { version = "0.44", features = [
windows-sys = { version = "0.48", features = [
"Win32_Foundation",
"Win32_System_Com",
"Win32_UI_Shell_Common",
Expand Down Expand Up @@ -76,4 +76,3 @@ name = "async"

[package.metadata.docs.rs]
features = ["file-handle-inner"]

23 changes: 14 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
fn main() {
let target = std::env::var("TARGET").unwrap();
let target_os = std::env::var("CARGO_CFG_TARGET_OS").expect("target OS not detected");

if target.contains("darwin") {
println!("cargo:rustc-link-lib=framework=AppKit");
}

#[cfg(all(feature = "gtk3", feature = "xdg-portal"))]
compile_error!("You can't enable both GTK3 & XDG Portal features at once");
match target_os.as_str() {
"macos" => println!("cargo:rustc-link-lib=framework=AppKit"),
"windows" => {}
_ => {
let gtk = std::env::var_os("CARGO_FEATURE_GTK3").is_some();
let xdg = std::env::var_os("CARGO_FEATURE_XDG_PORTAL").is_some();

#[cfg(not(any(feature = "gtk3", feature = "xdg-portal")))]
compile_error!("You need to choose at least one backend: `gtk3` or `xdg-portal` features");
if gtk && xdg {
panic!("You can't enable both `gtk3` and `xdg-portal` features at once");
} else if !gtk && !xdg {
panic!("You need to choose at least one backend: `gtk3` or `xdg-portal` features");
}
}
}
}
PolyMeilex marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 1 addition & 3 deletions src/backend/win_cid/file_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod dialog_ffi;
mod dialog_future;

use dialog_ffi::IDialog;
use dialog_ffi::{IDialog, Result};
use dialog_future::{multiple_return_future, single_return_future};

use crate::backend::DialogFutureType;
Expand All @@ -10,8 +10,6 @@ use crate::FileHandle;

use std::path::PathBuf;

use windows::core::Result;
Jake-Shadle marked this conversation as resolved.
Show resolved Hide resolved

use super::utils::init_com;

//
Expand Down
Loading