News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

"Auto restore" feature for autosave plug-in?

Started by Poobah, January 15, 2007, 05:14:52 AM

Previous topic - Next topic

Poobah

Hi, I use a computer that completely locks up about once or twice a day, so the autosave plug-in is a life saver! As someone who frequently uses it, I have found that it would be quite helpful if the autosave plug-in detected if it wasn't terminated correctly during its last session, and if it wasn't, prompted to replace the original files that were in use with the auto-saved ones whose modification dates were more recent than those of the original files. This feature would only be necessary for people who choose to save the backups as "original file name.save"

Revvy

One way of accomplishing this would simply be to pop up a dialog box asking if you want to open the .sav/.bak file if it's newer than the project file.
Cheers,
Revvy

Poobah

Are you suggesting I use some sort of scripting feature to do this? I don't even know what all that squirrel stuff is all about. :S

Revvy

No, I was simply thinking out loud about a change that could be made to the actual source of the IDE.
Cheers,
Revvy

thomas

The idea as such is good, I'll think about how it can be implemented.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Pecan

Quote from: thomas on January 17, 2007, 01:23:12 PM
The idea as such is good, I'll think about how it can be implemented.

I'm be interested also. Especially since the keybinder ini file can become corrupt during a crash while keybinder is doing a dynamic menu merge.

Can I ape your code?


Game_Ender

Do most crashes result in the "lock file" being left behind?  If so here is my solution:  If CB starts up and sees the lockfile still in place then it searches for all .bak files in the project it was last using (should be the most recently project).  If any of those .bak files have newer timestamps times than actuall file you know that the editor was closed while the user was still editing a file.  You can then prompt the user and restore the file.

eranon

#7
Does this feature (ability to autorestore or, even, manually from within C::B) implemented since 2007... I don't see it.

Also, I've noticed if you choose the option to save as original files (so, overwrite them), C::B still show the "*" beside filenames on its editor tabs. It would be smart that the autosave plugin warns C::B about external change (or do C::B considers the action of autosave as an internal save).

Third, it could be useful to have an option "save in a subdirectory" (using original filenames) : this way, external restore by hand will be just a simple copy, accepting the overwriting warning from OS. Just an idea.
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

thomas

I've completely forgotten about that feature, mostly because Code::Blocks didn't crash since approx. 2008 (which kind of makes autosave kind of superfluous)  :P

Uh... time... let me see if I find time for this, maybe between christmas and new year.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

oBFusCATed

Quote from: eanon on August 30, 2012, 12:13:31 AM
Also, I've noticed if you choose the option to save as original files (so, overwrite them), C::B still show the "*" beside filenames on its editor tabs. It would be smart that the autosave plugin warns C::B about external change (or do C::B considers the action of autosave as an internal save).
But it does just this, save the original file and the state of the file is set to not modified and the '*' is removed. I use this feature every day and I know it works.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Alpha

Some programs do crash recovery/auto restore in the following method:

  • Periodically save a copy of modified files (plus meta-data pointing to the location of the actual file) to a directory in the application data folder
  • When a file/project is saved (in Code::Blocks), delete the corresponding shadow copy (if it exists)
  • When a file/project is closed (in Code::Blocks), delete the corresponding shadow copy (if it exists)
  • On startup, check the recovery directory in the application data folder, if any files exist in it, prompt the user (for each file) to:
    • restore - shadow copy is written over the actual file, then shadow copy is deleted
    • discard - shadow copy is deleted
    • remind me later - nothing is done (the shadow copy still exists, so it will prompt on next startup)

This is different in that it can be done silently/invisibly, without the user ever seeing the extra files.  Maybe this would be an advantage, or maybe not; but it is another idea you could consider.

oBFusCATed

Alpha: Why bother doing reimplementing the wheel, when there is git :) (which does the same) or any backup solution native to your OS?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Alpha

I guess I forgot to mention (but I thought it was assumed?) this is for crash protection: the shadow copies would only exist on startup if Code::Blocks unexpectedly quit/crashed on the last run.
Maybe "shadow copy" was not the best choice of words.  It is not a backup of a file, but a snapshot of unsaved data.  So I do not believe this is a reimplementation of the wheel (as Code::Blocks does not currently have an "auto-restore from crash recovery files wheel" :)), just a different design option for the above discussed auto-restore feature.