Go Down

Topic: Please remove the infernal read only protection on Arduino example sketches (Read 2440 times) previous topic - next topic


pert

You can always just save the sketch somewhere else. I have my own versions of some of the example sketches I frequently use as sanity checks, mostly just with the useless comments removed.

You can edit the sketches with a text editor

You can make library example sketches editable by creating a file named .development in the library root folder, then restarting the Arduino IDE if it's running.

It does make sense to have the example sketches read-only because these are used as "known working" code. If it's easy for beginners to muck with them and then save they'll end up doing this without even realizing it and then waste a bunch of our time trying to figure out why Blink isn't working for them.

boylesg

You can always just save the sketch somewhere else. I have my own versions of some of the example sketches I frequently use as sanity checks, mostly just with the useless comments removed.

You can edit the sketches with a text editor

You can make library example sketches editable by creating a file named .development in the library root folder, then restarting the Arduino IDE if it's running.

It does make sense to have the example sketches read-only because these are used as "known working" code. If it's easy for beginners to muck with them and then save they'll end up doing this without even realizing it and then waste a bunch of our time trying to figure out why Blink isn't working for them.
In the wifiesp library for example, the example sketches have dummy SSIDs and KEYs. I really don't want to have to change them to my SSID and KEY every bloody time I open the sketches to test and idea etc.

And it is pain in the arse to have to have notepad++ open with the same sketch and have to edit the same sketch in two editors!

The read only protection serves no useful purpose!

If you fuck the library or sketch up you can just download the library again and overwrite your changes.

It would be so much easier if you/they just got rid of it or provided an option to turn it off for more advanced users.

pert

In the wifiesp library for example, the example sketches have dummy SSIDs and KEYs. I really don't want to have to change them to my SSID and KEY every bloody time I open the sketches to test and idea etc.
Then just save a modified version of the example to your sketchbook, it will actually be faster to access it in the menu.

The read only protection serves no useful purpose!

If you fuck the library or sketch up you can just download the library again and overwrite your changes.
If you read enough posts here you'll realize a beginner will never realize the problem was caused by something they did. The people trying to help the beginner may also take a while to realize this because the beginner will not want to post their code.

It would be so much easier if you/they just got rid of it or provided an option to turn it off for more advanced users.
They did provide an option. It's the .development file. That feature was specifically added on request to allow advanced users to edit the example files via the Arduino IDE.

boylesg

Quote
They did provide an option. It's the .development file. That feature was specifically added on request to allow advanced users to edit the example files via the Arduino IDE.
In File->Preferences would be nice.

An advanced settings tab could be added to provide quick and easy access to the advanced settings.

Where is the .development file?

boylesg

My other bug bear is that, if I do modify a sketch file outside the IDE, then Arduino won't detect the change and reload the file. So I am forced to kill the IDE and reload the sketch.

If newbies won't post their code then what difference does it make if it is an example sketch they have accidentally modified or one they have created from scratch?

pert

In File->Preferences would be nice.

An advanced settings tab could be added to provide quick and easy access to the advanced settings.
Advanced users don't need File > Preferences.

Where is the .development file?
You create it.

My other bug bear is that, if I do modify a sketch file outside the IDE, then Arduino won't detect the change and reload the file. So I am forced to kill the IDE and reload the sketch.
That's scheduled to be fixed in the next release:
https://github.com/arduino/Arduino/pull/6074
I agree that's definitely a necessary feature and one we would expect as standard.

If newbies won't post their code then what difference does it make if it is an example sketch they have accidentally modified or one they have created from scratch?
Because some of us are here trying to help them out even though it's much more difficult than it needs to be.

boylesg

Advanced users don't need File > Preferences.
This particular advanced user likes quick and easy convenience. :)


You create it.
That's scheduled to be fixed in the next release:
https://github.com/arduino/Arduino/pull/6074
I hope this link is going to tell me how to format it because I have not had any success finding any specific instructions re said file.

pert

I hope this link is going to tell me how to format it because I have not had any success finding any specific instructions re said file.
The link is referring to the IDE detecting outside changes to a file. I believe you're getting that mixed up with the .development flag file, which is a completely different topic. You don't need to do any formatting. It's just the presence of that file in the root of a library folder makes it not read only, the contents of the file are irrelevant, just leave it blank. As for instructions, unfortunately I don't believe the developer ever made the extra effort to document the feature. You would have had to chance across the mention of it buried in the issue tracker:
https://github.com/arduino/Arduino/issues/3512
Note that the library must have a library.properties file for this feature to work.

pert

This particular advanced user likes quick and easy convenience. :)
How frequently are you planning to change that setting?

boylesg

How frequently are you planning to change that setting?
First of all bloody windows 10 won't let me have a file or folder named .development - it insists on a file name.

This this whole writable library thing sill simply not work for me without a simple option in File->preferences

And it is far more convenient to have one simple preferences option that sets all libraries as writable or not, rather than having to go through every library and make sure it has library.properties. Assuming I was able to create the file flag in multiple library root folders in the first place.

It seems that I a far from the only person that is annoyed with this feature - I saw one comment along the lines of it serves no purpose but annoys everyone.

I vote for just getting rid of the f'ing thing!

pert

First of all bloody windows 10 won't let me have a file or folder named .development - it insists on a file name.
Yes, that's annoying but an advanced user can use the command line:
Code: [Select]
echo > .development
Once you've created one flag file you can copy it around all you like in Windows Explorer.

This this whole writable library thing sill simply not work for me without a simple option in File->preferences
Then you're not an advanced user and you should be saving copies of the modified example files to a different location.

It seems that I a far from the only person that is annoyed with this feature.
{{Citation needed}}. Note that in the issue I linked above the main desire was to be able to edit the library source in the Arduino IDE. The example sketches was a side issue but easier for the developers to fix. As for editing libraries, the Arduino Web Editor folks have said multiple times this is something on their roadmap so hopefully that feature will also make it into the standard IDE.

I vote for just getting rid of the f'ing thing!
I vote, against... Tie!

boylesg

Yes, that's annoying but an advanced user can use the command line:
Code: [Select]
echo > .development

Well then I stand corrected - I had implicitly assumed the Windows 10 command would impose the same restriction.

Then you're not an advanced user and you should be saving copies of the modified example files to a different location.
Yeah well I quite deliberately don't want to do that. It is bad enough having 3 separate folder locations where you can find Arduino libraries.

Without then multiplying that by 2 for writable versions of all the libraries, or just the examples

treii28

In the wifiesp library for example, the example sketches have dummy SSIDs and KEYs. I really don't want to have to change them to my SSID and KEY every bloody time I open the sketches to test and idea etc.
Copy the example to another directory called 'my example', change ssid keys. Create new code from your examples rather than the generic ones?

I didn't know 'cut/paste' was hard

treii28

Without then multiplying that by 2 for writable versions of all the libraries, or just the examples
I remove the examples and/or relocate them all-together on some of my installs. Sometimes I like to head north with some of my ESP toys and test them out under remote conditions. I bring along a raspberry pi with my config on it for making smaller changes to my code. I don't want to fill a raspberry pi with all sorts of junk.

I don't see what the difficulty is. Examples are probably write protected because you aren't supposed to be doing your own coding in the example code (which is, by design, stored in a different place from your working code). If you have a desire to change the example code, the intention (again, by design) is that you save a local copy in your working folder. If you don't want to follow the intended convention as to how the IDE is set up, I don't see how it is that big of a deal to turn off the write protection to make your changes.

Go Up