Where is Preferences.txt?

I am hoping that the Arduino IDE version 1.0.5 (MAC) has an autosave feature somewhere, but it doesn't appear in the preferences choices accessible from the IDE menu. Oddly, the location of the extended preferences menu is supposedly "Users/jrdoner/LIbrary/Arduino/preferences.txt" , but that doesn't appear in my file system. Even more oddly, when I try to create a "Library" folder in that location, the MAC claims there is already a file folder with that name.

So, what is going on? I would think that the Arduino IDE would need its preferences file just to start up. Also, is there an autosave feature available? I have lost a lot of hours of work due to this.

Thanks in advance for any insights.

John Doner

jrdoner:
I have lost a lot of hours of work due to this.

That should never happen - you should be compiling and testing your code far more frequently than that. I suggest you get in the habit of saving frequently (I save every minute or so, and whenever I stop to think). This applies to all editors (code, documents, drawings etc) not just the Arduino IDE, and if you develop the mindset that your work isn't safe until it has been saved it will stand you in good stead. Also get in the habit of using a change control system if you are working on anything that is important to you.

If you have compiled the code in the meantime then there may still be a copy of the generated C++ source in the temp compilation directory which would contain all the logic from your sketch.

What version of MacOS?
You definitely have a ~/Library/... directory "somewhere"; lots of other applications use it. I'm not sure what macs do to hide such directories in various operating system versions (if it does anything, I've got that turned off.)

BillW-MacOSX-2<9990> ls -l ~/Library/Arduino/
total 32
-rw-rw-r--  1 billw  staff  3830 Sep 28  2012 #preferences.txt#
-rw-r--r--  1 billw  staff  3866 Dec 15 17:16 preferences.txt
-rw-r--r--  1 billw  staff  3722 Sep 16  2008 preferences.txt.keep
-rw-r--r--  1 billw  staff  3865 Dec  8 01:21 preferences.txt~

There is no autosave function that I'm aware of.

Why should it be the user's responsibility to save changes? Its just bad software
if it lets you lose work just cause the plug was pulled.

You have the option of using an external editor if saving your program yourself is too much of a burden.

MarkT:
Why should it be the user's responsibility to save changes? Its just bad software
if it lets you lose work just cause the plug was pulled.

Why shouldn't the user be responsible for their actions? If you expect every piece of software in existence to protect you from ever making a mistake then you're in for some serious disappointment. The best way to avoid losing work is to save it somewhere safe. The more important your work is the more frequently and the more carefully you need to save it.

When I posted this, I said "Thanks in advance for any insights.", but that doesn't apply to those silly respondents who just want to carp about how they are so clever that they don't need autosave.

The very first compiler I ever used had autosave, because punch cards couldn't just disappear into thin air. Then, after about 15 years , disk drives became inexpensive enough to become more or less ubiquitous attachments to computers. Over that period, I've worked with dozens of compilers, as well as many word processors and graphics programs, and almost every one of them had an autosave option.

But if your so libertarian that you think that autosave is an unnecessary invasion of your freedom, go for it. When creating any sort of development tool, autosave is just good program design: for all those hardy pioneer types who don't want autosave, why don't you go back to coding in binary?

I've programmed in Java, and creating an autosave feature should take about 5 lines of code. While I am very grateful to the Arduino community for the very stable and convenient IDE they've created, I urge them to include autosave in the next release.

John Doner

jrdoner:
When I posted this, I said "Thanks in advance for any insights.", but that doesn't apply to those silly respondents who just want to carp about how they are so clever that they don't need autosave.

I don't think it's clever, I think it's obvious. You're the one who apparently lost "hours of work" through not saving it. With the extensive experience you describe, you ought to know better. I don't much care whether the IDE has autosave or not, but if there is development effort available I'd much rather it was spent fixing the existing issues rather than adding marginal new features.

As well as commenting that the problem was partly caused by your bad habits, I have suggested where you may be able to find a copy of an intermediate build file that you could use to recover the original sketch.

I've programmed in Java, and creating an autosave feature should take about 5 lines of code.

The source code is available. Let us know when you have implemented the autosave feature and where the improved IDE can be downloaded from.

Starting with 10.8, OSX now hides the user's Library folder from Finder's view.

You can access it by using Finder's Go -> Go To Folder, then typing in "~/Library".

Then I suggest you grab the "Library" Icon menubar (You know that all menu bar icons are draggable right?), and drag it into your sidebar. This will allow you to easily access it in the future.

Also, in the Arduino IDE's preferences you can click on the preference file "link", which will open the folder with the file.