Skip to content

Commit

Permalink
update recent files when newly saved
Browse files Browse the repository at this point in the history
  • Loading branch information
fralonra committed Dec 9, 2024
1 parent d1ac6fc commit a7208b0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/editor/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ impl EditorApp {
self.storage.recent_files.push(path);
}
Action::FileSave => {
let newly_save = self.config.file_path.is_none();

if let Some(path) = self.config.file_path.clone().or_else(|| {
let name = (!self.ppd.meta.name.is_empty())
.then_some(self.ppd.meta.name.as_str())
Expand All @@ -398,7 +400,10 @@ impl EditorApp {

create_file(&filename)
}) {
self.file_save_to_path(path)?;
self.file_save_to_path(&path)?;
if newly_save {
self.storage.recent_files.push(path);
}
}
}
Action::FileSaveAs => {
Expand All @@ -409,7 +414,8 @@ impl EditorApp {
if let Some(path) =
create_file(&format!("{}.{}", name.replace(" ", "_"), EXTENSION_NAME))
{
self.file_save_to_path(path)?;
self.file_save_to_path(&path)?;
self.storage.recent_files.push(path);
}
}
Action::FragmentAdapterBackgroundUpload => {
Expand Down

0 comments on commit a7208b0

Please sign in to comment.