diff -Nru rust-dirs-sys-0.3.7/Cargo.toml rust-dirs-sys-0.4.1/Cargo.toml --- rust-dirs-sys-0.3.7/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 +++ rust-dirs-sys-0.4.1/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 @@ -11,17 +11,28 @@ [package] name = "dirs-sys" -version = "0.3.7" +version = "0.4.1" authors = ["Simon Ochsenreither "] description = "System-level helper functions for the dirs and directories crates." readme = "README.md" license = "MIT OR Apache-2.0" repository = "https://github.com/dirs-dev/dirs-sys-rs" + +[dependencies.option-ext] +version = "0.2.0" + [target."cfg(target_os = \"redox\")".dependencies.redox_users] version = "0.4" default-features = false + [target."cfg(unix)".dependencies.libc] version = "0.2" -[target."cfg(windows)".dependencies.winapi] -version = "0.3" -features = ["knownfolders", "objbase", "shlobj", "winbase", "winerror"] + +[target."cfg(windows)".dependencies.windows-sys] +version = "0.48.0" +features = [ + "Win32_UI_Shell", + "Win32_Foundation", + "Win32_Globalization", + "Win32_System_Com", +] diff -Nru rust-dirs-sys-0.3.7/Cargo.toml.orig rust-dirs-sys-0.4.1/Cargo.toml.orig --- rust-dirs-sys-0.3.7/Cargo.toml.orig 1973-11-29 21:33:09.000000000 +0000 +++ rust-dirs-sys-0.4.1/Cargo.toml.orig 2006-07-24 01:21:28.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "dirs-sys" -version = "0.3.7" +version = "0.4.1" authors = ["Simon Ochsenreither "] description = "System-level helper functions for the dirs and directories crates." readme = "README.md" @@ -8,6 +8,9 @@ repository = "https://github.com/dirs-dev/dirs-sys-rs" maintenance = { status = "as-is" } +[dependencies] +option-ext = "0.2.0" + [target.'cfg(unix)'.dependencies] libc = "0.2" @@ -15,4 +18,9 @@ redox_users = { version = "0.4", default-features = false } [target.'cfg(windows)'.dependencies] -winapi = { version = "0.3", features = ["knownfolders", "objbase", "shlobj", "winbase", "winerror"] } +windows-sys = { version = "0.48.0", features = [ + "Win32_UI_Shell", + "Win32_Foundation", + "Win32_Globalization", + "Win32_System_Com", +] } diff -Nru rust-dirs-sys-0.3.7/.cargo_vcs_info.json rust-dirs-sys-0.4.1/.cargo_vcs_info.json --- rust-dirs-sys-0.3.7/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 +++ rust-dirs-sys-0.4.1/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 @@ -1,5 +1,6 @@ { "git": { - "sha1": "20cdf818af907f84f6ffcdee65f1add51f226896" - } -} + "sha1": "f369f0904bec9833572f24c988c7e48454173983" + }, + "path_in_vcs": "" +} \ No newline at end of file diff -Nru rust-dirs-sys-0.3.7/debian/changelog rust-dirs-sys-0.4.1/debian/changelog --- rust-dirs-sys-0.3.7/debian/changelog 2022-07-02 20:29:54.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/changelog 2023-07-25 10:13:55.000000000 +0000 @@ -1,3 +1,9 @@ +rust-dirs-sys (0.4.1-1) unstable; urgency=medium + + * Package dirs-sys 0.4.1 from crates.io using debcargo 2.6.0 + + -- kpcyrd Tue, 25 Jul 2023 12:13:55 +0200 + rust-dirs-sys (0.3.7-1) unstable; urgency=medium * Team upload. diff -Nru rust-dirs-sys-0.3.7/debian/control rust-dirs-sys-0.4.1/debian/control --- rust-dirs-sys-0.3.7/debian/control 2022-07-02 20:29:54.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/control 2023-07-25 10:13:55.000000000 +0000 @@ -7,18 +7,14 @@ rustc:native , libstd-rust-dev , librust-libc-0.2+default-dev , - librust-winapi-0.3+default-dev , - librust-winapi-0.3+knownfolders-dev , - librust-winapi-0.3+objbase-dev , - librust-winapi-0.3+shlobj-dev , - librust-winapi-0.3+winbase-dev , - librust-winapi-0.3+winerror-dev + librust-option-ext-0.2+default-dev Maintainer: Debian Rust Maintainers Uploaders: kpcyrd -Standards-Version: 4.5.1 +Standards-Version: 4.6.1 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/dirs-sys] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/dirs-sys +X-Cargo-Crate: dirs-sys Rules-Requires-Root: no Package: librust-dirs-sys-dev @@ -27,20 +23,15 @@ Depends: ${misc:Depends}, librust-libc-0.2+default-dev, - librust-winapi-0.3+default-dev, - librust-winapi-0.3+knownfolders-dev, - librust-winapi-0.3+objbase-dev, - librust-winapi-0.3+shlobj-dev, - librust-winapi-0.3+winbase-dev, - librust-winapi-0.3+winerror-dev + librust-option-ext-0.2+default-dev Provides: librust-dirs-sys+default-dev (= ${binary:Version}), librust-dirs-sys-0-dev (= ${binary:Version}), librust-dirs-sys-0+default-dev (= ${binary:Version}), - librust-dirs-sys-0.3-dev (= ${binary:Version}), - librust-dirs-sys-0.3+default-dev (= ${binary:Version}), - librust-dirs-sys-0.3.7-dev (= ${binary:Version}), - librust-dirs-sys-0.3.7+default-dev (= ${binary:Version}) + librust-dirs-sys-0.4-dev (= ${binary:Version}), + librust-dirs-sys-0.4+default-dev (= ${binary:Version}), + librust-dirs-sys-0.4.1-dev (= ${binary:Version}), + librust-dirs-sys-0.4.1+default-dev (= ${binary:Version}) Description: Helper functions for the dirs crate - Rust source code This package contains the source for the Rust dirs-sys crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-dirs-sys-0.3.7/debian/copyright rust-dirs-sys-0.4.1/debian/copyright --- rust-dirs-sys-0.3.7/debian/copyright 2022-07-02 20:29:54.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/copyright 2023-07-25 10:13:55.000000000 +0000 @@ -5,14 +5,14 @@ Files: * Copyright: - 2018-2022 Simon Ochsenreither - 2018-2022 dirs-rs contributors + 2018-2023 Simon Ochsenreither + 2018-2023 dirs-rs contributors License: MIT or Apache-2.0 Files: debian/* Copyright: - 2019-2022 Debian Rust Maintainers - 2019 kpcyrd + 2019-2023 Debian Rust Maintainers + 2019-2023 kpcyrd License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-dirs-sys-0.3.7/debian/copyright.debcargo.hint rust-dirs-sys-0.4.1/debian/copyright.debcargo.hint --- rust-dirs-sys-0.3.7/debian/copyright.debcargo.hint 2022-07-02 20:29:54.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/copyright.debcargo.hint 2023-07-25 10:13:55.000000000 +0000 @@ -12,7 +12,7 @@ be correct information so you should review and fix this before uploading to the archive. -Files: ./LICENSE-MIT +Files: LICENSE-MIT Copyright: 2018-2019 dirs-rs contributors License: UNKNOWN-LICENSE; FIXME (overlay) Comment: @@ -21,8 +21,8 @@ Files: debian/* Copyright: - 2019-2022 Debian Rust Maintainers - 2019-2022 kpcyrd + 2019-2023 Debian Rust Maintainers + 2019-2023 kpcyrd License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-dirs-sys-0.3.7/debian/patches/foreign-operating-systems.patch rust-dirs-sys-0.4.1/debian/patches/foreign-operating-systems.patch --- rust-dirs-sys-0.3.7/debian/patches/foreign-operating-systems.patch 1970-01-01 00:00:00.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/patches/foreign-operating-systems.patch 2023-07-25 10:13:55.000000000 +0000 @@ -0,0 +1,23 @@ +Index: dirs-sys/Cargo.toml +=================================================================== +--- dirs-sys.orig/Cargo.toml ++++ dirs-sys/Cargo.toml +@@ -21,18 +21,5 @@ + [dependencies.option-ext] + version = "0.2.0" + +-[target."cfg(target_os = \"redox\")".dependencies.redox_users] +-version = "0.4" +-default-features = false +- + [target."cfg(unix)".dependencies.libc] + version = "0.2" +- +-[target."cfg(windows)".dependencies.windows-sys] +-version = "0.48.0" +-features = [ +- "Win32_UI_Shell", +- "Win32_Foundation", +- "Win32_Globalization", +- "Win32_System_Com", +-] diff -Nru rust-dirs-sys-0.3.7/debian/patches/series rust-dirs-sys-0.4.1/debian/patches/series --- rust-dirs-sys-0.3.7/debian/patches/series 2022-07-02 20:29:54.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/patches/series 2023-07-25 10:13:55.000000000 +0000 @@ -1 +1 @@ -strip-nightly-redox-users.patch +foreign-operating-systems.patch diff -Nru rust-dirs-sys-0.3.7/debian/patches/strip-nightly-redox-users.patch rust-dirs-sys-0.4.1/debian/patches/strip-nightly-redox-users.patch --- rust-dirs-sys-0.3.7/debian/patches/strip-nightly-redox-users.patch 2022-07-02 20:29:54.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/patches/strip-nightly-redox-users.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -Index: dirs-sys/Cargo.toml -=================================================================== ---- dirs-sys.orig/Cargo.toml -+++ dirs-sys/Cargo.toml -@@ -18,9 +18,6 @@ description = "System-level helper funct - readme = "README.md" - license = "MIT OR Apache-2.0" - repository = "https://github.com/dirs-dev/dirs-sys-rs" --[target."cfg(target_os = \"redox\")".dependencies.redox_users] --version = "0.4" --default-features = false - [target."cfg(unix)".dependencies.libc] - version = "0.2" - [target."cfg(windows)".dependencies.winapi] diff -Nru rust-dirs-sys-0.3.7/debian/tests/control rust-dirs-sys-0.4.1/debian/tests/control --- rust-dirs-sys-0.3.7/debian/tests/control 2022-07-02 20:29:54.000000000 +0000 +++ rust-dirs-sys-0.4.1/debian/tests/control 2023-07-25 10:13:55.000000000 +0000 @@ -1,14 +1,14 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test dirs-sys 0.3.7 --all-targets --all-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test dirs-sys 0.4.1 --all-targets --all-features Features: test-name=rust-dirs-sys:@ Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test dirs-sys 0.3.7 --all-targets +Test-Command: /usr/share/cargo/bin/cargo-auto-test dirs-sys 0.4.1 --all-targets Features: test-name=librust-dirs-sys-dev:default Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test dirs-sys 0.3.7 --all-targets --no-default-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test dirs-sys 0.4.1 --all-targets --no-default-features Features: test-name=librust-dirs-sys-dev: Depends: dh-cargo (>= 18), @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-dirs-sys-0.3.7/.github/workflows/ci.yml rust-dirs-sys-0.4.1/.github/workflows/ci.yml --- rust-dirs-sys-0.3.7/.github/workflows/ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ rust-dirs-sys-0.4.1/.github/workflows/ci.yml 2006-07-24 01:21:28.000000000 +0000 @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse + RUST_BACKTRACE: full + +jobs: + build-and-test: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v3 + - name: Build + run: cargo build --verbose + - name: Test + run: cargo test --verbose -- --nocapture diff -Nru rust-dirs-sys-0.3.7/README.md rust-dirs-sys-0.4.1/README.md --- rust-dirs-sys-0.3.7/README.md 1973-11-29 21:33:09.000000000 +0000 +++ rust-dirs-sys-0.4.1/README.md 2006-07-24 01:21:28.000000000 +0000 @@ -1,9 +1,7 @@ -[![crates.io](https://img.shields.io/crates/v/dirs-sys.svg)](https://crates.io/crates/dirs-sys) -[![API documentation](https://docs.rs/dirs-sys/badge.svg)](https://docs.rs/dirs-sys/) -![actively developed](https://img.shields.io/badge/maintenance-as--is-yellow.svg) -[![TravisCI status](https://img.shields.io/travis/dirs-dev/dirs-sys-rs/master.svg?label=Linux/macOS%20build)](https://travis-ci.org/dirs-dev/dirs-sys-rs) -[![AppVeyor status](https://img.shields.io/appveyor/ci/soc/dirs-sys-rs/master.svg?label=Windows%20build)](https://ci.appveyor.com/project/soc/dirs-sys-rs/branch/master) -![License: MIT/Apache-2.0](https://img.shields.io/badge/license-MIT%2FApache--2.0-orange.svg) +[![crates.io](https://img.shields.io/crates/v/dirs-sys.svg?style=for-the-badge)](https://crates.io/crates/dirs-sys) +[![API documentation](https://img.shields.io/docsrs/dirs-sys/latest?style=for-the-badge)](https://docs.rs/dirs-sys/) +![actively developed](https://img.shields.io/badge/maintenance-as--is-yellow.svg?style=for-the-badge) +![License: MIT/Apache-2.0](https://img.shields.io/badge/license-MIT%2FApache--2.0-orange.svg?style=for-the-badge) # `dirs-sys` @@ -26,9 +24,6 @@ This library is written in Rust, and supports Linux, Redox, macOS and Windows. Other platforms are also supported; they use the Linux conventions. -The minimal required version of Rust is 1.13 except for Redox, where the minimum Rust version -depends on the [`redox_users`](https://crates.io/crates/redox_users) crate. - ## Build It's possible to cross-compile this library if the necessary toolchains are installed with rustup. diff -Nru rust-dirs-sys-0.3.7/src/lib.rs rust-dirs-sys-0.4.1/src/lib.rs --- rust-dirs-sys-0.3.7/src/lib.rs 1973-11-29 21:33:09.000000000 +0000 +++ rust-dirs-sys-0.4.1/src/lib.rs 2006-07-24 01:21:28.000000000 +0000 @@ -1,3 +1,5 @@ +extern crate option_ext; + use std::ffi::OsString; use std::path::PathBuf; @@ -27,7 +29,7 @@ use super::libc; -// https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/os.rs#L498 +// https://github.com/rust-lang/rust/blob/2682b88c526d493edeb2d3f2df358f44db69b73f/library/std/src/sys/unix/os.rs#L595 pub fn home_dir() -> Option { return env::var_os("HOME") .and_then(|h| if h.is_empty() { None } else { Some(h) }) @@ -132,78 +134,82 @@ pub use self::target_unix_not_mac::{user_dir, user_dirs}; #[cfg(target_os = "windows")] -extern crate winapi; +extern crate windows_sys as windows; #[cfg(target_os = "windows")] mod target_windows { +use std::ffi::c_void; use std::ffi::OsString; use std::os::windows::ffi::OsStringExt; use std::path::PathBuf; -use std::ptr; use std::slice; -use super::winapi; -use super::winapi::shared::winerror; -use super::winapi::um::{combaseapi, knownfolders, shlobj, shtypes, winbase, winnt}; +use super::windows::Win32; +use super::windows::Win32::UI::Shell; -pub fn known_folder(folder_id: shtypes::REFKNOWNFOLDERID) -> Option { +pub fn known_folder(folder_id: windows::core::GUID) -> Option { unsafe { - let mut path_ptr: winnt::PWSTR = ptr::null_mut(); - let result = shlobj::SHGetKnownFolderPath(folder_id, 0, ptr::null_mut(), &mut path_ptr); - if result == winerror::S_OK { - let len = winbase::lstrlenW(path_ptr) as usize; + let mut path_ptr: windows::core::PWSTR = std::ptr::null_mut(); + let result = Shell::SHGetKnownFolderPath( + &folder_id, + 0, + Win32::Foundation::HANDLE::default(), + &mut path_ptr + ); + if result == 0 { + let len = windows::Win32::Globalization::lstrlenW(path_ptr) as usize; let path = slice::from_raw_parts(path_ptr, len); let ostr: OsString = OsStringExt::from_wide(path); - combaseapi::CoTaskMemFree(path_ptr as *mut winapi::ctypes::c_void); + windows::Win32::System::Com::CoTaskMemFree(path_ptr as *const c_void); Some(PathBuf::from(ostr)) } else { - combaseapi::CoTaskMemFree(path_ptr as *mut winapi::ctypes::c_void); + windows::Win32::System::Com::CoTaskMemFree(path_ptr as *const c_void); None } } } pub fn known_folder_profile() -> Option { - known_folder(&knownfolders::FOLDERID_Profile) + known_folder(Shell::FOLDERID_Profile) } pub fn known_folder_roaming_app_data() -> Option { - known_folder(&knownfolders::FOLDERID_RoamingAppData) + known_folder(Shell::FOLDERID_RoamingAppData) } pub fn known_folder_local_app_data() -> Option { - known_folder(&knownfolders::FOLDERID_LocalAppData) + known_folder(Shell::FOLDERID_LocalAppData) } pub fn known_folder_music() -> Option { - known_folder(&knownfolders::FOLDERID_Music) + known_folder(Shell::FOLDERID_Music) } pub fn known_folder_desktop() -> Option { - known_folder(&knownfolders::FOLDERID_Desktop) + known_folder(Shell::FOLDERID_Desktop) } pub fn known_folder_documents() -> Option { - known_folder(&knownfolders::FOLDERID_Documents) + known_folder(Shell::FOLDERID_Documents) } pub fn known_folder_downloads() -> Option { - known_folder(&knownfolders::FOLDERID_Downloads) + known_folder(Shell::FOLDERID_Downloads) } pub fn known_folder_pictures() -> Option { - known_folder(&knownfolders::FOLDERID_Pictures) + known_folder(Shell::FOLDERID_Pictures) } pub fn known_folder_public() -> Option { - known_folder(&knownfolders::FOLDERID_Public) + known_folder(Shell::FOLDERID_Public) } pub fn known_folder_templates() -> Option { - known_folder(&knownfolders::FOLDERID_Templates) + known_folder(Shell::FOLDERID_Templates) } pub fn known_folder_videos() -> Option { - known_folder(&knownfolders::FOLDERID_Videos) + known_folder(Shell::FOLDERID_Videos) } } diff -Nru rust-dirs-sys-0.3.7/src/xdg_user_dirs.rs rust-dirs-sys-0.4.1/src/xdg_user_dirs.rs --- rust-dirs-sys-0.3.7/src/xdg_user_dirs.rs 1973-11-29 21:33:09.000000000 +0000 +++ rust-dirs-sys-0.4.1/src/xdg_user_dirs.rs 2006-07-24 01:21:28.000000000 +0000 @@ -6,6 +6,8 @@ use std::path::{Path, PathBuf}; use std::str; +use option_ext::OptionExt; + /// Returns all XDG user directories obtained from $(XDG_CONFIG_HOME)/user-dirs.dirs. pub fn all(home_dir_path: &Path, user_dir_file_path: &Path) -> HashMap { let bytes = read_all(user_dir_file_path).unwrap_or(Vec::new()); @@ -32,7 +34,7 @@ let key = if key.starts_with(b"XDG_") && key.ends_with(b"_DIR") { match str::from_utf8(&key[4..key.len()-4]) { Ok(key) => - if user_dir.is_some() && option_contains(user_dir, key) { + if user_dir.contains(&key) { single_dir_found = true; key } else if user_dir.is_none() { @@ -137,18 +139,12 @@ unescaped } -fn option_contains(option: Option, value: T) -> bool { - match option { - Some(val) => val == value, - None => false - } -} - #[cfg(test)] mod tests { use std::collections::HashMap; use std::path::{Path, PathBuf}; - use super::{trim_blank, shell_unescape, split_once, parse_user_dirs}; + + use super::{parse_user_dirs, shell_unescape, split_once, trim_blank}; #[test] fn test_trim_blank() {