Skip to content

Commit 0395169

Browse files
chore(deps): update rust crate freedesktop_entry_parser to v2 (tauri-apps#488)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: FabianLars <github@fabianlars.de>
1 parent a47ecb9 commit 0395169

File tree

5 files changed

+19
-32
lines changed

5 files changed

+19
-32
lines changed

Cargo.lock

Lines changed: 9 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ plist = "1"
9393
ureq = { version = "3", default-features = false, features = ["gzip"] }
9494

9595
[target."cfg(target_os = \"linux\")".dependencies]
96-
freedesktop_entry_parser = "1.3"
96+
freedesktop_entry_parser = "2.0"
9797

9898
[target."cfg(unix)".dependencies]
9999
libc = "0.2"

src/opts.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@ use serde::{Deserialize, Serialize};
22
#[cfg(feature = "cli")]
33
use structopt::clap::arg_enum;
44

5-
#[derive(Clone, Copy, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
5+
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
66
pub enum NoiseLevel {
7+
#[default]
78
Polite,
89
LoudAndProud,
910
FranklyQuitePedantic,
1011
}
1112

12-
impl Default for NoiseLevel {
13-
fn default() -> Self {
14-
Self::Polite
15-
}
16-
}
17-
1813
impl NoiseLevel {
1914
pub fn from_occurrences(occurrences: u64) -> Self {
2015
match occurrences {

src/os/linux/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ impl Application {
7474
// We absolutely want the Exec value
7575
exec_command: parsed_entry
7676
.section("Desktop Entry")
77-
.attr("Exec")
77+
.and_then(|s| s.attr("Exec").first())
7878
.ok_or(DetectEditorError::ExecFieldMissing)?
7979
.into(),
8080
// The icon is optional, we try getting it because the Exec value may need it
8181
icon: parsed_entry
8282
.section("Desktop Entry")
83-
.attr("Icon")
83+
.and_then(|s| s.attr("Icon").first())
8484
.map(Into::into),
8585
xdg_entry_path: entry_filepath,
8686
})
@@ -136,15 +136,14 @@ pub fn open_file_with(
136136

137137
let command_parts = entry
138138
.section("Desktop Entry")
139-
.attr("Exec")
139+
.and_then(|s| s.attr("Exec").first())
140140
.map(|str_entry| {
141-
let osstring_entry: OsString = str_entry.into();
142141
xdg::parse_command(
143-
&osstring_entry,
142+
str_entry.as_ref(),
144143
path_str,
145144
entry
146145
.section("Desktop Entry")
147-
.attr("Icon")
146+
.and_then(|s| s.attr("Icon").first())
148147
.map(|s| s.as_ref()),
149148
Some(&entry_path),
150149
)

src/os/linux/xdg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pub fn find_entry_by_app_name(
6767
if let Ok(parsed) = parse_entry(&entry_path) {
6868
if parsed
6969
.section("Desktop Entry")
70-
.attr("Name")
71-
.map(str::as_ref)
70+
.and_then(|s| s.attr("Name").first())
71+
.map(|s| s.as_ref())
7272
== Some(app_name)
7373
{
7474
return Some((parsed, entry_path));

0 commit comments

Comments
 (0)