-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto saving #412
base: master
Are you sure you want to change the base?
Auto saving #412
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks nice and simple, I like it!
Some general feedback (I didn't fully check the code yet):
- When people disable timestamps on their files to save some (SSD) wear and tear, detecting the newest autosave is not going to work. Why not keep on counting, instead of going back to 1? Then you just grab the highest number autosave. (yes, we'd have to actively delete the lowest number)
- Is there another edge case when the project is saved? When you load it again, the autosaves should not be loaded as they are older...? (Maybe it works because the focus will be lost after saving and quitting, so a quick autosave is dropped? 🤔 )
- There are quite a bunch of unrelated (mostly? formatting) changes in this PR.
- Missing changelog entry (can be done just before merging though)
For me this whole idea is good enough, and I think for the others as well. So feel free to clean up and we'll fully review and accept when all is addressed.
@veger I will check those points tomorrow :) About the timestamp, that is unfortunate. Keeping an infinite counter would fix that, but would make it significant more complex (deleting older files, more difficult to find the highest save file, because AFAIK it is not easy to search the filesystem with regex.) Maybe we would need to accept that this minorty should manually select te right one (disabling the checkbox when loading the save) |
f90c29e
to
24c5aa9
Compare
|
Ah... you also read the timestamp of the original file? Then it should be fine! (I didn't fully check your code yet) When I have some (more) time I'll do a proper review. |
This is a continuation of the discussion in the draft PR here
This fixes issue 22
How it works:
When loading a project there is a new setting:
![afbeelding](https://private-user-images.githubusercontent.com/22354811/411970749-0169c866-901c-491a-86e2-989bef65d16a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTIxMDMsIm5iZiI6MTczOTYxMTgwMywicGF0aCI6Ii8yMjM1N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YzMxYjAyNWRlMGIwNzE4MTMzN2U0MjQ5ZjEwN2EzZDA0YTRkYmUyOWE4NGI2MDg2ODg4ZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5pWYG1gmGdCe0INGVEuxpoLEBUGQU_x-phn-WxqnWJs)
When disabled it will just load the save you selected (whether it is your main save or an autosave doesn't matter), when it is enabled it will try to find the most recent save you have.
In the case above autosave-1.yafc would be loaded eventhough the user selected "project-yafc".
When manually saving you will always save the 'main' file (project.yafc in the above case), this because autosaves get overwritten real fast, so when you would open an auto-save and forget to change the save path you would quickly lose that manual save.
There is one 'edge' case in which the user manually changes the filename of the autosave, but this wont break anything.
Let me know what you guys think, if everyone agrees that this is a solid solution then I will add some tests.