Very frustrating. A few times, I wanted to work borrow from a previous sketch, take some functions, delete other for a new sketch and I then select “Save As” and start chopping away, saving, etc, all the while thinking I am doing this on the newly created program. Then I notice the IDE is not editing my new titled sketch but has kept me on the original which is now full of incorrect changes. Is this a glitch in the Arduino IDE or maybe a setup issue I overlooked?
I've seen people mentioning this with IDE 2.x. Never experienced it myself on Win 11 (or Win 10 in the past).
If you're using IDE 2.x you can search that category; not sure if causes and solution were found.
I use Save As all the time, I see no issues, but I am using a Mac.
When you open the old .ino file in the editor, save it under the new filename. That way you isolate that text from the old filename, and you can edit it as you wish.
When you clicked on “Save As” what name did you give for the new file?
I have done save as hundreds of times and have yet to have a problem. I am on Linux. This has been done with several versions of 1.xx and 2.x. This is an easy for me to set up the new directory where I want it. One of the later versions even copied all of the include files in that directory as well, saving me some time.
Where do you save your sketches? Local disk?
Any chance that you have non-ascii characters (e.g. Chinese) in your username?
Next time, check the filename in the title bar of the IDE; did it change?
This structure should work
sketchbook
+-- mySketch
| +-- mysketch.ino
+--mySketchSavedAs
| +--mySketchSavedAs.ino
This structure might not work
sketchbook
+-- mySketch
| +-- mysketch.ino
| +-- mySketchSavedAs
| +--mySketchSavedAs.ino
Do you have the Auto Save option enabled? I think most people have this disabled, if not it might be the cause of your problems.
Auto Save
Possibly the worst feature of the IDE
Does it still default to on when the IDE is installed ?
Don’t know as it is a long time since I installed an IDE, but it used to be.
And the best feature if your PC falls asleep and the IDE forgets all the work that you have done in the past hour or so when the PC wakes up ![]()
Yes.
the something is very wrong with your computer? Or is this specific to the Arduino IDE?
I don’t know if the Arduino IDE is among them, but many MacOS apps can weather a power outage… although I would not rely on it. Sleep should not be any problem for any app.
a7
I'm not sure if it relates to Windows only but it is definitely an IDE thing
There might be a few more but these are the first ones I found on github when searching the IDE 2.x issues
IDE displays a blank loading screen after windows sleep cycle · Issue #2747 · arduino/arduino-ide · GitHub
After exiting sleep mode, IDE reloads and changes are lost · Issue #2704 · arduino/arduino-ide · GitHub
IDE might get into a non-functional state after OS sleep/awake cycle · Issue #2148 · arduino/arduino-ide · GitHub
I use the external editor function and Geany on Linux. It automatically saves in the background and when I launch it it has the last file(s) loaded the same as before shutdown unless closed. If I get a power fail I lose only a few minutes.
Another thing I do before whacking away is save a good copy as filename(YYMMDDHHMM).txt and it resides with the .ino files without any problems. I also save the whole folder with a similar naming on the server at the end of the day. It does not take long and has saved me many times.The way I look at it disk space is a lot less costly then my time. I started doing this when the backup failed (it did not work for weeks but no notification) on my windoze machine many years ago.
A post was split to a new topic: Compilation failures caused by code from previous sketch after "Save As"
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.