Put settings.json where the Android entry point said, not under /
SettingsStore::open read XDG_CONFIG_HOME and HOME itself. Neither exists on Android, so it resolved to .config/darkroom relative to a working directory of /, and every settings edit on the tablet failed with "read-only file system" — the page reported the error and nothing said why. The doc comment claimed "the same resolution SessionStore does"; now it is, by calling the same function, which honours the directory android_main declares and takes the platform's config directory everywhere else. settings.json sits beside sessions.json on every platform, as the comment always said it did.
This commit is contained in:
@@ -25,12 +25,17 @@ pub struct SettingsStore {
|
|||||||
impl SettingsStore {
|
impl SettingsStore {
|
||||||
/// Open the store at the platform config location.
|
/// Open the store at the platform config location.
|
||||||
///
|
///
|
||||||
/// `settings.json` in the platform's config directory — `dr_plat::dirs`
|
/// **The same resolution `SessionStore` makes**, by calling the same
|
||||||
/// has the rule per platform — which is the same resolution `SessionStore`
|
/// function, so `settings.json` sits beside `sessions.json` on every
|
||||||
/// makes, so the two files sit together and a user backing up one takes
|
/// platform. That is `dr_plat::dirs`' config directory on a desktop and
|
||||||
/// both.
|
/// the directory the entry point declared on Android — the second half
|
||||||
|
/// was the bug: this used to read `XDG_CONFIG_HOME` and `HOME` itself,
|
||||||
|
/// neither exists on Android, and the result was `.config/darkroom`
|
||||||
|
/// relative to a working directory of `/`. Every settings edit on a
|
||||||
|
/// tablet failed with "read-only file system", and the page said so
|
||||||
|
/// without saying why.
|
||||||
pub fn open() -> Self {
|
pub fn open() -> Self {
|
||||||
Self::open_at(dr_plat::base_dir(dr_plat::Base::Config).join("settings.json"))
|
Self::open_at(dr_sync::account::config_dir().join("settings.json"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Open at an explicit path — for tests, and for a non-default location.
|
/// Open at an explicit path — for tests, and for a non-default location.
|
||||||
|
|||||||
Reference in New Issue
Block a user