From 63c2fdba4c84f6eb99ca9a5ad092d23cd23bb35f Mon Sep 17 00:00:00 2001 From: Azalea Date: Tue, 2 Jun 2026 00:51:57 +0000 Subject: [PATCH] [F] Fix #503? --- crates/hyfetch/src/neofetch_util.rs | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/crates/hyfetch/src/neofetch_util.rs b/crates/hyfetch/src/neofetch_util.rs index 35b61f23..dac766f2 100644 --- a/crates/hyfetch/src/neofetch_util.rs +++ b/crates/hyfetch/src/neofetch_util.rs @@ -237,6 +237,26 @@ pub fn macchina_path() -> Result> { Ok(macchina_path) } +#[cfg(feature = "macchina")] +fn macchina_themes_path() -> Result { + #[cfg(target_os = "macos")] + { + return Ok(PathBuf::from( + env::var_os("HOME").context("`HOME` env var is not set or invalid")?, + ) + .join(".config") + .join("macchina") + .join("themes")); + } + + #[cfg(not(target_os = "macos"))] + { + let project_dirs = directories::ProjectDirs::from("", "", "macchina") + .context("failed to get base dirs")?; + Ok(project_dirs.config_dir().join("themes")) + } +} + /// Gets the distro ascii of the current distro. Or if distro is specified, get /// the specific distro's ascii art instead. #[tracing::instrument(level = "debug")] @@ -539,9 +559,8 @@ pub fn get_distro_name(backend: Backend) -> Result { // Write macchina theme to temp file let theme_file_path = { - let project_dirs = directories::ProjectDirs::from("", "", "macchina") - .context("failed to get base dirs")?; - let themes_path = project_dirs.config_dir().join("themes"); + let themes_path = + macchina_themes_path().context("failed to get macchina themes dir")?; fs::create_dir_all(&themes_path).with_context(|| { format!("failed to create macchina themes dir {themes_path:?}") })?; @@ -698,9 +717,7 @@ fn run_macchina(asc: String, args: Option<&Vec>, palette: Option