Autosave: keep recovery files out of Recent Files
Recovering a file loaded it through the normal load path, which added it to Recent Files — so an internal recovered-*.beam in the app data dir showed up in the Recent list (and could even be auto-reopened as "last session"). Skip add_recent_file for recovery paths on load, and clean any that older builds already leaked into Recent at startup (before the auto-reopen check reads it).
This commit is contained in:
parent
5f09222f3f
commit
ef2b0822bd
|
|
@ -1379,7 +1379,17 @@ impl EditorApp {
|
||||||
cc.egui_ctx.options_mut(|o| o.zoom_with_keyboard = false);
|
cc.egui_ctx.options_mut(|o| o.zoom_with_keyboard = false);
|
||||||
|
|
||||||
// Load application config
|
// Load application config
|
||||||
let config = AppConfig::load();
|
let mut config = AppConfig::load();
|
||||||
|
// One-time cleanup: earlier builds added a Recovered file to Recent on restore. Drop any
|
||||||
|
// recovery-dir paths that leaked in (and re-save if we removed any) so they don't show in
|
||||||
|
// Recent or get auto-reopened below.
|
||||||
|
let recent_before = config.recent_files.len();
|
||||||
|
config
|
||||||
|
.recent_files
|
||||||
|
.retain(|p| !AutosaveState::is_recovery_path(p));
|
||||||
|
if config.recent_files.len() != recent_before {
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we should auto-reopen last session
|
// Check if we should auto-reopen last session
|
||||||
let pending_auto_reopen = if config.reopen_last_session {
|
let pending_auto_reopen = if config.reopen_last_session {
|
||||||
|
|
@ -4746,9 +4756,12 @@ impl EditorApp {
|
||||||
// Point the raster paging store at the loaded container so faulting works.
|
// Point the raster paging store at the loaded container so faulting works.
|
||||||
self.raster_store.set_path(self.current_file_path.clone());
|
self.raster_store.set_path(self.current_file_path.clone());
|
||||||
|
|
||||||
// Add to recent files
|
// Add to recent files — but never a recovery file (it's an internal, transient container in
|
||||||
self.config.add_recent_file(path.clone());
|
// the app data dir, not a project the user opened).
|
||||||
self.update_recent_files_menu();
|
if !AutosaveState::is_recovery_path(&path) {
|
||||||
|
self.config.add_recent_file(path.clone());
|
||||||
|
self.update_recent_files_menu();
|
||||||
|
}
|
||||||
|
|
||||||
// Set active layer
|
// Set active layer
|
||||||
if let Some(first) = self.action_executor.document().root.children.first() {
|
if let Some(first) = self.action_executor.document().root.children.first() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue