Fix literal-tilde XDG fallback bug in profiles_dir
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.
This commit is contained in:
parent
13863836bc
commit
f8f9c72709
1 changed files with 8 additions and 3 deletions
|
|
@ -30,9 +30,14 @@ pub struct Profile {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn profiles_dir() -> PathBuf {
|
pub fn profiles_dir() -> PathBuf {
|
||||||
dirs::config_dir()
|
// Was `dirs::config_dir().unwrap_or_else(|| PathBuf::from("~/.config"))`
|
||||||
.unwrap_or_else(|| PathBuf::from("~/.config"))
|
// — same literal-tilde-fallback bug found (and fixed) in breadclip-core
|
||||||
.join("breadmon/profiles")
|
// 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<()> {
|
pub fn save(profile: &Profile) -> Result<()> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue