Fix rustfmt formatting in icon.rs #1
1 changed files with 5 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use freedesktop_icons::lookup;
|
||||
use std::path::PathBuf;
|
||||
use std::{env, fs};
|
||||
|
||||
const ICON_SIZE: u16 = 32;
|
||||
|
||||
|
|
@ -47,7 +48,7 @@ fn desktop_file_icon_name(desktop_entry: &str) -> Option<String> {
|
|||
let path = dir
|
||||
.join("applications")
|
||||
.join(format!("{desktop_entry}.desktop"));
|
||||
if let Ok(contents) = std::fs::read_to_string(&path)
|
||||
if let Ok(contents) = fs::read_to_string(&path)
|
||||
&& let Some(icon) = parse_icon_key(&contents)
|
||||
{
|
||||
return Some(icon);
|
||||
|
|
@ -58,11 +59,11 @@ fn desktop_file_icon_name(desktop_entry: &str) -> Option<String> {
|
|||
|
||||
fn data_dirs() -> Vec<PathBuf> {
|
||||
let mut dirs = vec![];
|
||||
if let Some(home) = std::env::var_os("HOME") {
|
||||
if let Some(home) = env::var_os("HOME") {
|
||||
dirs.push(PathBuf::from(home).join(".local/share"));
|
||||
}
|
||||
let xdg_data_dirs = std::env::var("XDG_DATA_DIRS")
|
||||
.unwrap_or_else(|_| "/usr/local/share:/usr/share".to_string());
|
||||
let xdg_data_dirs =
|
||||
env::var("XDG_DATA_DIRS").unwrap_or_else(|_| "/usr/local/share:/usr/share".to_string());
|
||||
dirs.extend(xdg_data_dirs.split(':').map(PathBuf::from));
|
||||
dirs
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue