From f8f9c72709931fdaaa58076b99fc920cf8cca844 Mon Sep 17 00:00:00 2001 From: Breadway Date: Fri, 17 Jul 2026 10:09:49 +0800 Subject: [PATCH] Fix literal-tilde XDG fallback bug in profiles_dir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit profiles_dir() had the same bug as breadclip-core::data_dir and breadpad-shared's model_dir/config_path/style_css_path (found during tonight's ecosystem-utils pass): `dirs::config_dir().unwrap_or_else(|| PathBuf::from("~/.config"))` — PathBuf/std::fs never expand `~`, so on a box where `dirs` can't resolve a home directory this would silently resolve to a directory literally named `~` under the current working directory. Switched to bread_utils::xdg::config_dir. --- src/profile.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/profile.rs b/src/profile.rs index 233aa50..b108b2e 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -30,9 +30,14 @@ pub struct Profile { } pub fn profiles_dir() -> PathBuf { - dirs::config_dir() - .unwrap_or_else(|| PathBuf::from("~/.config")) - .join("breadmon/profiles") + // Was `dirs::config_dir().unwrap_or_else(|| PathBuf::from("~/.config"))` + // — same literal-tilde-fallback bug found (and fixed) in breadclip-core + // and breadpad-shared during tonight's ecosystem-utils pass: PathBuf/ + // std::fs never expand `~`, so on a box where `dirs` can't resolve a + // home directory this would silently resolve to a directory literally + // named `~` under the current working directory instead of the user's + // actual home. + bread_utils::xdg::config_dir("breadmon/profiles") } pub fn save(profile: &Profile) -> Result<()> {