Skip to content

Commit b2ce4cc

Browse files
edfloreshzmmstick
authored andcommitted
fix: add cfg for unix only packages
1 parent 58fc034 commit b2ce4cc

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/desktop.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
#[cfg(not(windows))]
12
pub use freedesktop_desktop_entry::DesktopEntry;
3+
#[cfg(not(windows))]
24
pub use mime::Mime;
3-
use std::{
4-
borrow::Cow,
5-
ffi::OsStr,
6-
path::{Path, PathBuf},
7-
};
5+
use std::path::{Path, PathBuf};
6+
#[cfg(not(windows))]
7+
use std::{borrow::Cow, ffi::OsStr};
88

99
#[derive(Debug, Clone, PartialEq, Eq)]
1010
pub enum IconSource {
@@ -42,12 +42,14 @@ impl Default for IconSource {
4242
}
4343
}
4444

45+
#[cfg(not(windows))]
4546
#[derive(Debug, Clone, PartialEq)]
4647
pub struct DesktopAction {
4748
pub name: String,
4849
pub exec: String,
4950
}
5051

52+
#[cfg(not(windows))]
5153
#[derive(Debug, Clone, PartialEq, Default)]
5254
pub struct DesktopEntryData {
5355
pub id: String,
@@ -62,13 +64,15 @@ pub struct DesktopEntryData {
6264
pub prefers_dgpu: bool,
6365
}
6466

67+
#[cfg(not(windows))]
6568
pub fn load_applications<'a>(
6669
locale: impl Into<Option<&'a str>>,
6770
include_no_display: bool,
6871
) -> Vec<DesktopEntryData> {
6972
load_applications_filtered(locale, |de| include_no_display || !de.no_display())
7073
}
7174

75+
#[cfg(not(windows))]
7276
pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> bool {
7377
let lowercase_wm_class = match entry.wm_class.as_ref() {
7478
Some(s) => Some(s.to_lowercase()),
@@ -80,6 +84,7 @@ pub fn app_id_or_fallback_matches(app_id: &str, entry: &DesktopEntryData) -> boo
8084
|| app_id.to_lowercase() == entry.name.to_lowercase()
8185
}
8286

87+
#[cfg(not(windows))]
8388
pub fn load_applications_for_app_ids<'a, 'b>(
8489
locale: impl Into<Option<&'a str>>,
8590
app_ids: impl Iterator<Item = &'b str>,
@@ -123,6 +128,7 @@ pub fn load_applications_for_app_ids<'a, 'b>(
123128
applications
124129
}
125130

131+
#[cfg(not(windows))]
126132
pub fn load_applications_filtered<'a, F: FnMut(&DesktopEntry) -> bool>(
127133
locale: impl Into<Option<&'a str>>,
128134
mut filter: F,
@@ -148,6 +154,7 @@ pub fn load_applications_filtered<'a, F: FnMut(&DesktopEntry) -> bool>(
148154
.collect()
149155
}
150156

157+
#[cfg(not(windows))]
151158
pub fn load_desktop_file<'a>(
152159
locale: impl Into<Option<&'a str>>,
153160
path: impl AsRef<Path>,
@@ -160,6 +167,7 @@ pub fn load_desktop_file<'a>(
160167
})
161168
}
162169

170+
#[cfg(not(windows))]
163171
impl DesktopEntryData {
164172
fn from_desktop_entry<'a>(
165173
locale: impl Into<Option<&'a str>>,
@@ -229,6 +237,7 @@ impl DesktopEntryData {
229237
}
230238
}
231239

240+
#[cfg(not(windows))]
232241
pub async fn spawn_desktop_exec<S, I, K, V>(exec: S, env_vars: I, app_id: Option<&str>)
233242
where
234243
S: AsRef<str>,
@@ -293,6 +302,7 @@ where
293302
}
294303
}
295304

305+
#[cfg(not(windows))]
296306
#[cfg(feature = "desktop-systemd-scope")]
297307
#[zbus::proxy(
298308
interface = "org.freedesktop.systemd1.Manager",

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub mod keyboard_nav;
7575

7676
#[cfg(feature = "desktop")]
7777
pub mod desktop;
78-
#[cfg(feature = "process")]
78+
#[cfg(all(feature = "process", not(windows)))]
7979
pub mod process;
8080

8181
#[cfg(feature = "wayland")]

0 commit comments

Comments
 (0)