Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deterministic unit tests #3

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
fix: look up $XDG_DATA_DIRS/pixmaps in addition to icons
lilyinstarlight authored and mmstick committed Dec 5, 2024
commit 4e761c29e39759a28334abb9266f1523200bcc51
8 changes: 5 additions & 3 deletions src/theme/paths.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ use crate::theme::error::ThemeError;

pub(crate) static BASE_PATHS: Lazy<Vec<PathBuf>> = Lazy::new(icon_theme_base_paths);

/// Look in $HOME/.icons (for backwards compatibility), in $XDG_DATA_DIRS/icons and in /usr/share/pixmaps (in that order).
/// Look in $HOME/.icons (for backwards compatibility), in $XDG_DATA_DIRS/icons, in $XDG_DATA_DIRS/pixmaps and in /usr/share/pixmaps (in that order).
/// Paths that are not found are filtered out.
fn icon_theme_base_paths() -> Vec<PathBuf> {
let home_icon_dir = home_dir().expect("No $HOME directory").join(".icons");
@@ -19,9 +19,11 @@ fn icon_theme_base_paths() -> Vec<PathBuf> {
let mut data_dirs: Vec<_> = bd
.get_data_dirs()
.into_iter()
.map(|p| p.join("icons"))
.flat_map(|p| [p.join("icons"), p.join("pixmaps")])
.collect();
data_dirs.push(bd.get_data_home().join("icons"));
let data_home = bd.get_data_home();
data_dirs.push(data_home.join("icons"));
data_dirs.push(data_home.join("pixmaps"));
data_dirs
})
.unwrap_or_default();