0

I'm writing a library, and that library .cpp/.h code is in devel/arduino/libraries/LightBrightLib/. I have test code that calls that library, and an example program using the library. Right now they're in /devel/arduino/lightbright/LightBrightMain/ and /devel/arduino/lightbright/LightBrightLibTest/.

I see most libraries have an examples directory inside the library, so I tried moving mine to /devel/arduino/libraries/LightBrightLib/examples/LightBrightMain/ and /devel/arduino/libraries/LightBrightLib/examples/LightBrightLibTest/

When I do that, and try to save my LightBrightMain.ino file into /devel/arduino/libraries/LightBrightLib/examples/LightBrightMain/, it says "You cannot save a sketch into a folder inside itself. This would go on forever.". And of course it won't let me select the examples directory or any other directory above it.

How do other library makers do this? Maybe they don't use the IDE, or they copy it in outside the IDE, or use symlinks? What does the IDE think it's doing and why is it fighting putting the file where it already is?

NOTE: This is not a file permission problem as I own all files

asked Jun 28, 2016 at 3:56

1 Answer 1

0

What I normally do is make the examples in their own folders (ie. inside the sketchbook folder). Then when they are tested I just use the file system to move the folders into the "examples" folder under the library.

When I do that, and try to save my LightBrightMain.ino file into /devel/arduino/libraries/LightBrightLib/examples/LightBrightMain/,

The IDE makes the folder, so you would (if this works at all) save LightBrightMain into the examples folder. Don't make a folder of the same name as the sketch. The IDE does that.

answered Jun 28, 2016 at 4:35
3
  • I removed the directories under examples and tried that, and it worked. However... when I modify it and try to save it, it says 'Some files are "read-only", so you'll need to re-save the sketch to another location'. Of course the files are NOT read only. Commented Jun 28, 2016 at 5:04
  • It always does that when you open an example file from the IDE. The idea is to stop you corrupting the example. Open them with an external editor if you want to tweak them, or move them somewhere else as required. Commented Jun 28, 2016 at 5:46
  • But this is MY example. OK I guess I need to give up. It's not possible using the IDE. Thanks Commented Jun 28, 2016 at 6:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.