Persist last-opened library file across restarts; fix path-switch bug
- Remember which library.db was last chosen (via a small config.json in the app-data dir) so relaunching the app reopens the same file instead of always defaulting to library.db. - Fix set_library_path returning a hard error (and thus never updating the topbar) whenever the reference catalog fails to reopen against the new path — e.g. a stale reference.db schema. Picking a library file and successfully reattaching the reference db are separate concerns; the chosen path now always persists and is reported back, with the catalog reopened best-effort. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,8 +40,12 @@ pub fn get_status(db: Db) -> Res<Status> {
|
||||
#[tauri::command]
|
||||
pub fn set_library_path(db: Db, path: String) -> Res<Status> {
|
||||
let mut s = db.lock().unwrap();
|
||||
s.library_path = PathBuf::from(path);
|
||||
s.reopen()?;
|
||||
s.set_library_path(PathBuf::from(path));
|
||||
// Best-effort reopen: the chosen path must stick (and be reported back)
|
||||
// even if the reference db can't currently be attached (e.g. stale
|
||||
// schema pending an "Update card data" run) — that's a separate concern
|
||||
// from which library file is open.
|
||||
let _ = s.reopen();
|
||||
Ok(status_of(&s))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user