Workspaces: Save, Save As, Rename and Delete fail when the file isn't written (#696)

This commit is contained in:
tylerjenningsw
2026-10-12 21:32:18 -04:00
parent 73ea427015
commit b9a9a0a414
6 changed files with 56 additions and 8 deletions
+10 -3
View File
@@ -428,9 +428,16 @@ impl EffectcraftApp {
}
/// Keep the saved workspaces for the next session (see [`EffectcraftApp::new`]): After
/// Effects' saved workspaces last until they are deleted (#320).
pub(crate) fn store_saved_workspaces(&mut self) {
self.save_workspace_state();
/// Effects' saved workspaces last until they are deleted (#320). `Err` when they weren't
/// written (#696): the layouts stay usable and a later save retries, but a restart loses them.
pub(crate) fn store_saved_workspaces(&mut self) -> Result<(), String> {
let Err(error) = self.workspace_store.save_now(self.session.config.as_deref(), &self.ui) else { return Ok(()) };
let message = format!("Workspaces are kept for this session only and won't be there after a restart: {error}");
log::warn!("{message}");
self.ui.status = message.clone();
// The raw error, so the background retry doesn't report the same failure again.
self.workspace_store.error = Some(error);
Err(message)
}
/// Offer the frontend's commands (tools, timeline navigation…) for keyboard shortcuts.