Sometime i work on a arduino script i will leave the mac and do other things, the mac will flip into screensaver and after that he goes into power saving mode and disabled display and other hardware.
When i come back and want to edit my sketch further everything is lost which is not saved. This isn't how mac widnows work.
Now i have to write again the script i was working on.
Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.
It might be possible to recover your code in a different way. Arduino IDE copies your sketch to a temporary folder during the compilation process. It is possible the full sketch is still stored in that folder. It would be at this location:
(where <username> is your macOS username, <some hash> is some characters used to differentiate the folder name, and <sketch name> is the name of the sketch)
The Library folder is hidden by default. You can make it visible by pressing the Command+Shift+. keyboard shortcut.
Note that a .cpp file extension has been appended to the original sketch filename.
You can try doing a search through that folder for the filename of your sketch.
This storage location is temporary in nature. It might be overwritten by Arduino IDE or deleted by your operating system at any time. So if you are going to try to recover the sketch from this location, you should do it as soon as possible and immediately move it to a safe location once you find it.
You should also be careful to avoid performing actions that could possibly trigger the loss of the data before attempting the recovery:
Do not compile or upload your sketch in Arduino IDE.
Do not close Arduino IDE.
Do not shut down or restart your computer.
Do not perform any operations to automatically free up disk space.
If you find the sketch file in the temporary folder, you will notice Arduino IDE made some changes in the code. These changes are minimal so it will be easy to convert the code back to your original sketch. We can help you out with that if you have trouble.
@janjuno That's strange. My Library folder is, and as far as I know, always has been visible. Since I have gone through many OS upgrades I would think if I did remove hidden in the deep past the upgrades may have re hidden it. Or maybe not.
I don't think I have ever turned my Mac off; I just close the lid. I very frequently have new sketches as a result of copying from the forum to look at somebody's problem, and I do not remember ever losing anything.
Recently, as in today and in the last few days, I have 'lost' all my libraries. I just restarted the IDE, and that fixed it, but nothing was actually lost, just no longer in the side panel.
Just FYI, none of this bothers me enough to complain, but thought you should know just in case it helps.
@ptillisch THX For that Info! Lets hope they fix that asap.
@sonofcy it is more related to not saving a sketch and going into sleep mode an coming back, which everything not saved is lost. Has nothing to do with the librarys.
I was explaining MY symptoms, I don't lose sketches, but I do lose libraries, so the Arduino team may be able to use that info to help in the bug hunt. As I said, I have never powered my Mac off I just put it to sleep by closing the lid, and I often (almost daily) have unsaved sketches. That means it may be more than just sleep that causes it. Maybe the sleep system is different on Silicon Macs than on Intel Macs.
It is expected that you will encounter the bug no matter which specific mechanism is used to put the Mac into sleep mode.
Do you have the "auto save" preference enabled @sonofcy? You can check by selecting Arduino IDE > Settings... from the Arduino IDE menus, and then looking to see whether or not the checkbox next to "Auto save" is filled in the "Preferences" dialog.
The changes to the sketch will only be lost on sleep if you have the "auto save" preference disabled. It is likely that a relatively small number of users are affected by the bug due to the fact that the preference is enabled by default and most users likely are satisfied enough by the default configuration that they don't bother to disable it.
NO, it did disappear. I guess I have just gotten lucky in the past. OR it's just my work habits, knowing I was going to put my computer aside, I either saved the sketch I was working on or in the case of a test, ended without saving. I am impressed if I always remembered to do that, but without evidence to the contrary, that must be it, OR I lost data/code that was unimportant (VERY likely as I take better care of MY code).
Thanks for the education.