I hope you are all doing well.
I am developing many libraries for Arduino and I am tired of surprises here and there specially when it comes to folder and sub folder related issues. I kind of hope a guide is written for advance users so that they do not waste time digging information in various places.
- IDE is not the best choice, so I started using Sublime and Stino to solve the issue. It may not be the best but considering my limited experience so far, it has been way better than Arduino IDE. I will be happy if anyone has a better suggestions. Sublime and Stino run pretty decent only issue is that rarely files do not get compiled after you have changed them. Some compiler messages are also not shown but I guess it is no big deal. I have seen the Arduino list for different IDE but there are so many mixed opinions about them. I tried to setup few of them but gave up int he process (Not recently though)
From here let's assume you want to develop a library and you want to integrate SVN/Git with your progress. First question will be right after you want to start.
- How do I do it?
S1: I make library folder as a place to keep my working copy and then edit the library folder directly. the issue with this solutions is that by doing so if your library has multiple .h files and folder, you will not be able to access them from an .ino file. For a finished library this seems fine because you know exactly what user is going to use and the functions are all tested, but if you are developing you need to test the internal functions and also the interface may change so by early estimation of functions used by user, you will rewrite many lines of boring code (wrapper).
S2: Sketch file become working copy and you develop library from there.
The issue with solution is that now you cannot have any folder structure and you will need to change all the include lines after you want to make it a library and save it in Library folder. When you save it in library folder, you need to either restructure your repository folder or you need to have a different folder for codes that already become library. First approach is very time consuming, and in second approach you loose the history of the file (there may be a work around this but I cannot think of easy solution, I am not a pro SVN, Git user).
S3: I have no idea.
- The unusual rules of sub folder support has changed over the years and it makes it very difficult to know what is the current level of support. So far from my understanding and testing:
a) Sub folder can exist in library folder, but those files are not accessible from .ino file. (I tested this and it did not work, but I have read that it is possible)
b) Sub folder in sketch cannot be included.
c) Arduino Library folder name and the main .h file should match so that IDE can include it.
I think Arduino has a lot more support for new users than for advance users and it is kind of sad. I know a lot of advance users have found solutions for all the problems mentioned above but I have had a very hard time finding a legit one piece article that cover all the stuff.
Sorry if the message is a bit negatively written, I just figured out about 3)a) and I changed one of the very huge library thinking that it would work fine.