From 26e50ae723826e5de54ef53db70c52b7a9a482d1 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sat, 3 Oct 2026 22:18:19 -0400 Subject: [PATCH] Save presets beside the settings, not under a raw HOME PresetStore::open built its path from XDG_CONFIG_HOME or HOME. Android sets neither, so the library resolved to /.config/darkroom, which is read-only, and every preset saved on the tablet failed. Windows sets no HOME either and got a directory relative to the working directory. The settings store was moved to dr_sync::account::config_dir for the same reason in 0.12.1; the presets now follow it. Linux and macOS resolve to the same file as before. --- ui/dr-ui/src/preset_store.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ui/dr-ui/src/preset_store.rs b/ui/dr-ui/src/preset_store.rs index 710133a..f9179ea 100644 --- a/ui/dr-ui/src/preset_store.rs +++ b/ui/dr-ui/src/preset_store.rs @@ -27,17 +27,14 @@ pub struct PresetStore { impl PresetStore { /// Open the store at the platform config location. /// - /// Linux: `$XDG_CONFIG_HOME/darkroom/presets.drpl`, falling back to - /// `~/.config` — the same resolution `SettingsStore` does, so the files sit - /// together and a user backing up one takes all of them. + /// Beside `settings.json`, in [`dr_sync::account::config_dir`], so a user + /// backing up one takes all of them. Never from `HOME` directly: Android + /// declares its data directory rather than setting `HOME`, and a path + /// built from an empty one is `/.config`, which is read-only — every + /// preset saved on the tablet failed. Windows sets no `HOME` either, and + /// got a directory relative to wherever the app was started. pub fn open() -> Self { - let dir = std::env::var_os("XDG_CONFIG_HOME") - .map(PathBuf::from) - .unwrap_or_else(|| { - PathBuf::from(std::env::var("HOME").unwrap_or_default()).join(".config") - }) - .join("darkroom"); - Self::open_at(dir.join(format!( + Self::open_at(dr_sync::account::config_dir().join(format!( "presets.{}", dr_pipeline::preset::LIBRARY_EXTENSION )))