Author Topic: "Auto restore" feature for autosave plug-in?  (Read 8827 times)

Poobah

  • Guest
"Auto restore" feature for autosave plug-in?
« on: January 15, 2007, 05:14:52 am »
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"

Offline Revvy

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: "Auto restore" feature for autosave plug-in?
« Reply #1 on: January 15, 2007, 06:20:36 pm »
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

  • Guest
Re: "Auto restore" feature for autosave plug-in?
« Reply #2 on: January 16, 2007, 03:03:44 am »
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

Offline Revvy

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: "Auto restore" feature for autosave plug-in?
« Reply #3 on: January 17, 2007, 02:30:02 am »
No, I was simply thinking out loud about a change that could be made to the actual source of the IDE.
Cheers,
Revvy

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: "Auto restore" feature for autosave plug-in?
« Reply #4 on: January 17, 2007, 01:23:12 pm »
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."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2104
Re: "Auto restore" feature for autosave plug-in?
« Reply #5 on: January 17, 2007, 02:38:55 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?

 

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: "Auto restore" feature for autosave plug-in?
« Reply #6 on: January 19, 2007, 11:09:00 pm »
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.

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: "Auto restore" feature for autosave plug-in?
« Reply #7 on: August 30, 2012, 12:13:31 am »
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.
« Last Edit: August 30, 2012, 12:15:10 am by eanon »
[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"]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: "Auto restore" feature for autosave plug-in?
« Reply #8 on: November 13, 2012, 03:46:26 pm »
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."

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11142
    • Travis build status
Re: "Auto restore" feature for autosave plug-in?
« Reply #9 on: November 13, 2012, 04:25:51 pm »
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!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: "Auto restore" feature for autosave plug-in?
« Reply #10 on: November 14, 2012, 11:48:31 pm »
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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11142
    • Travis build status
Re: "Auto restore" feature for autosave plug-in?
« Reply #11 on: November 15, 2012, 12:08:56 am »
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!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: "Auto restore" feature for autosave plug-in?
« Reply #12 on: November 15, 2012, 12:23:57 am »
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.