I am running the new release 2.3.0 with updated boards.
I opened a sketch from my sketch folder... Actually sort of from a sub-directory of sketch folder.
Where the sub-directory is a link to a github project on another disk:
Noice the lock symbol next to the sketch file name...
I closed the sketch and reopened it (using the open recent and this time, It opened up without the lock symbol and was able to edit the file without problem...
Also nice to see the orientation appears to be different from the OV7670 camera I was using
edited that as well..
I have tried multiple suggested ideas. Even doing a Saving As into a different folder doesn't work. It seems that the Read Only flag is set when saving example sketches. If a Save As is used should the IDE not then uncheck the read-only flag? The only way I can get around this is to save/save as the sketch and then have my Windows File Explorer open and uncheck the read-only flag. This is annoying to say the least. It seems like this has been an issue for years now.
I am a new user of Arduino but find it very annoying when you want to take an example sketch and modify it. If I do a Save As then it means I want to edit, simply unchecking the read-only flag during this action would resolve this issue?
Note: I have only had this happen a few times since I posted. I know that I have edited and saved examples. And so far have not seen any correlation of editing and saving examples. Maybe there is.
At times I wonder if maybe other things that are going on. Like maybe a background process who does disk cleanup and removes files from temp. Or maybe a virus protection install, that decides that maybe it does not like some file and then quarantines it. I am not sure if I have had this happen again since I went back to Norton from Symantec... Don't really like either of them, but...
Might help others to maybe understand what is going on and maybe resolve it, if you posted some additional information, like:
What OS (windows, Mac, Linux)
What version of Arduino
Maybe what board type you are editing for.
Are you running a virus protection package? If so which one
Had the computer sat for awhile since Arduino started and maybe either you explicitly put it to sleep or the system decided to suspend it... (other issue with this happening at times on windows)
...
The bug of Arduino IDE incorrectly treating sketches opened from symbolic links or Windows directory junctions via the File > Sketchbook or SKETCHBOOK view in the side panel is tracked by the developers here:
Are you still using sketches that are symlinks or directory junctions?
Maybe. But not sure. That is most of the time I am now opening sketches from the libraries, it is my own libraries, where I want to save the changes... So while the library is for sure still a link into the Arduino libraries directory to my github project, I often open the example from the github library directory.
Certainly not intentionally. My hypothesis is that what is actually happening is that the "read-only" file attribute was somehow set on the examples in your file system. The file attributes are preserved even when you make a copy of a sketch by saving in Arduino IDE.
We have had a couple reports of problems people were having with sketches, which were finally found to be caused by the read-only file attribute having been unexpectedly set. The conclusion has been that it is Windows doing this, not Arduino IDE, as discussed here:
Please use Windows File Explorer to open the properties of one of the original example files (not your saved copy) you had this problem with and check to see if the read-only file attribute is set.
I downloaded a sketch from @Merlin513 that was contained in a zip file. I opened the zip file and I double clicked on the .INO file within the zip file which opened a read only window (which was probably not too unexpected)
I've seen this before when a sketch is downloaded from a third party site. What I did to resolve it was just to copy the entire sketch into a fresh new one. Works every time. Hope this helps.
What I would normally do is to unzip the file and open it.... Which works fine.
But thought I would report that once it opens up the zip file, opening other sketches can have issues. So potentially could be added to existing github issue and/or new one...
No worries my friend. I think what you're experiencing is done by design, not entirely sure why but it happens every time I download code. Have a wonderful day.
Thanks @KurtE. It is very interesting. Unfortunately I am not able to reproduce the fault even though I tried following your instructions very carefully.
I am able to reproduce the behavior of the IDE treating the sketch opened from inside a ZIP archive as read-only, but as you say that is a reasonable behavior since it would not be trivial to support writing to files in ZIP archives. I see VS Code has the same behavior.