Where'd my code go?

Yesterday I wrote a program so that I could get values from an IR distance sensor and use them to control MIDI. When I went to open it today, the file was just blank. Nothing at all inside.

Is there some special way I'm supposed to close the IDE to prevent this, or what? My computer didn't crash mid-edit or anything like that.

Well when you close a IDE window, any code you have entered or changed from the original opening will be saved if you answer yes to the dialog window (which pops up when you close the window) to save, or it won't save any changes made if you answered no to that dialog. Could you have possibly clicked no instead of yes? I have never noticed the IDE 'losing' any of my programs.

You always have the option to explicitly save or save as from the file drop down menu at anytime, without having to close the IDE window you are working in.

Lefty

Version 0017 had some saving issues...
Are you using 0018?
I have also never come across the IDE 'losing' programs though.

Mowcius

The Arduino does not save when you compile/upload. IMO that is silly. I have lost several sketches when my PC crashed and I did not save.

Now I have an OCD about it...

The Arduino does not save when you compile/upload. IMO that is silly. I have lost several sketches when my PC crashed and I did not save.

I would not want it to as I often do some modifications to a sketch, only to then upload it and revert back to the old version. Auto save might be good if you could chose to turn it off. Maybe a backup save rather than saving the actual sketch. Then maybe there could be something like you get on office for document recovery.

Mowcius

I would not want it to as I often do some modifications to a sketch, only to then upload it and revert back to the old version.

Most IDE's have the undo buffer persist beyond saving. That is what I would normally do. Not sure if the Arduino IDE does that.

Most IDE's have the undo buffer persist beyond saving. That is what I would normally do. Not sure if the Arduino IDE does that.

Yeah but I mean big changes. More than a few undo commands.

I dunno, it might be ok.

I guess what we really need is automatic source control :slight_smile: