|
Post by u9 on Apr 27, 2007 12:04:56 GMT -5
Maybe the IDE should make an autosave to some file it uses in case the program crashes while running or the user does something stupid. That way the environment can return to the same state when rebooted and the user doesn't loose any data. I know, "just save your file before running" but this basic idea sometimes gets forgotten and some people (including myself) have lost lots of work because of it
|
|
|
Post by hartnell on Apr 28, 2007 4:41:38 GMT -5
It would be a useful feature, but what about this :
I'm experimenting with the code and ... the autosave saves "experimental code" ... and then it crashes...
--hartnell
|
|
|
Post by u9 on Apr 29, 2007 3:14:06 GMT -5
Well obviously the IDE should be able to save a text file without crashing. Otherwise I would consider the system seriously unstable. It shouldn't be that difficult to implement robustly. But I'm not sure you understood. I mean the code that is in the editor when you press F5 should be saved.
And actually, it shouldn't be autosave but rather a privately kept backup that the IDE would reload if it was not shut down properly. It must not automatically save over the user's source code without his knowledge.
|
|
|
Post by Guilect on Apr 29, 2007 17:19:00 GMT -5
So what about the case where I am running space shooter and I have 7 windows open because I just made changes to the 7 include files that the main file uses. I should save all 7 of them to autosave1, autosave2, autosave3... or should it just be the screen that is active when F5 is pressed?
In theory you could have 50 or more screens opens.
And in general it would put some time between when you press F5 and the time your code actually runs. So the fewer the files the better.
I would like to suggest that just the active screen, the screen you are most likely to be working on, be saved to "autosave.b2d" anytime the F5 (or run button) is pressed.
|
|
|
Post by u9 on Apr 30, 2007 4:55:28 GMT -5
Yeah. It is a bit problematic that there opens a new IDE for every file. But as you say, it should be the active window when you press F5 (or run). Basically what I am thinking is that it is able to restore the state as it was before it crashed. Ergo, any files opened will be reopened (with unsaved changes included). So it can't be a b2d file but rather some internal format which is able to know which files were opened and what their content was at the time of the crash When the IDE exits normally it can delete the autosave file and then when it is started the next time if the file exists it knows that it crashed and can inform the user that it has returned to the state prior to the crash (or something like that). Of course no autosave file needs to be made if there is no unsaved file opened. So what do you think? Too much work? If this is too complicated one could also just warn the user before running that he has unsaved changes. That is kind of a quick fix but the downside is that (i think) it requires using the mouse when selecting ok/cancel (which i personally seldom do).
|
|
|
Post by ptrxyz on Apr 30, 2007 6:37:27 GMT -5
How about creating some temporary copy of the file? Look at this:
you have your program source saved as test.b2d. if you press F5 a file called test.b2d.bak is created and compiled and finally ran (this file should also contain the include files, saying, they are just added on top of the test.b2d.bak). But, when you save the file manually, the changes are saved to test.b2d
bak file would look like this:
--- includefile1 --- --- includefile2 --- --- includefile3 --- ---- test.b2d ----
there also should be no problem with global variables, since a variable declared in an include file has its values in the main programm, too.
|
|
|
Post by Guilect on Apr 30, 2007 18:47:04 GMT -5
Here is what has been implemented so far. It is better than nothing.
The active code window will be saved to "autosave.b2d" in the app's root directory if it has not already been saved when either pressing F5 or the run button on the toolbar. Upon successful running this file is deleted. If the run is not successful then the next time you start B2D this autosave file is automatically loaded into the IDE then deleted You can then review/change/save it as whatever.
|
|
|
Post by u9 on May 1, 2007 11:13:07 GMT -5
Nice
|
|
|
Post by ptrxyz on May 7, 2007 14:34:10 GMT -5
yep. fine.
|
|