Skip to content

Commit 29d112e

Browse files
committed
Canonicalising FDE paths & replacing printlns with tracing::error macro
1 parent 9334579 commit 29d112e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cosmic-settings/src/pages/system/default_apps.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,20 @@ impl Page {
256256
match system_actions {
257257
Err(e) => {
258258
// we don't have system_actions set?
259-
println!("{}", e);
259+
tracing::error!(?e, "Unable to get system_actions shortcuts config");
260260
}
261261
Ok(mut actions) => {
262262
let default_paths = default_paths();
263263
let mut resolved_path = None;
264264

265265
// loop through all FDE paths to try and find a valid .desktop file
266266
for path in default_paths {
267-
let full_path = path.join([appid, ".desktop"].concat());
268-
if full_path.exists() && full_path.is_file() {
269-
resolved_path = Some(full_path);
270-
break;
267+
if let Ok(mut full_path) = path.canonicalize() {
268+
full_path = full_path.join([appid, ".desktop"].concat());
269+
if full_path.exists() && full_path.is_file() {
270+
resolved_path = Some(full_path);
271+
break;
272+
}
271273
}
272274
}
273275

@@ -279,7 +281,7 @@ impl Page {
279281
actions.insert(System::Terminal, String::from(exec));
280282

281283
if let Err(e) = shortcuts.set("system_actions", actions) {
282-
println!("{}", e);
284+
tracing::error!(?e, "Unable to set system_actions shortcuts config");
283285
}
284286
}
285287

0 commit comments

Comments
 (0)