Common Location for Custom Libraries

Hi all.
So, I have several "portable" Arduino IDE installations of various versions. Each one has the installed libraries located in its own "…\portable\sketchbook\libraries". That's fine as I can continue to compile my legacy projects using the libraries with which they were debugged.

But, I'd like to have a common directory containing libraries that I've written myself that could be accessed by all of the IDE installations. So, is there a way to add a custom folder to the library search path?


1 Like

Look in you Documents directory where your Sketches are saved.
There should be a Library directory there; this is where you can save shared libraries you have written.

As I said, each portable installation has an individual "…\portable\sketchbook\libraries" directory. What I want is a common directory that I can add to the search path of ALL the portable installations so they all pull my self-written libraries from the same place.

I use Portable Arduino, so that the regular background copy process to an external USB hard disk has a working copy of all my current work.

I can then easily use the USB hard disk to replicate my Arduino environment on a laptop when I go on my travels.

The two locations where I keep libraries are;


The custom ones tend to go in the Portable\sketchbook\libraries folder.

That's still not what I want. Let me take one more run at this ..... I have SEVERAL portable IDE installations. Each one has its own library path. For example:


Now what I want is an additional, COMMON library folder for my self-made libraries. Let's call it:
D:\Custom Arduino Libraries

What I want is for each of the portable IDE installations to continue looking in their respective "...\portable\sketchbook\libraries" locations. But, I ALSO want each of them to search in "D:\Custom Arduino Libraries" to resolve library #include(s).

This is easy in Sloeber / Eclipse where I do all of my serious code development. But, I'd like to use the same technique with the Arduino IDE.

I hope what I'm asking is clear now.

I can't think of any way you could do this with the Arduino IDE. You can configure all the portable installations to use the same single sketchbook folder, but that doesn't meet your "additional" requirement.

I suppose you could add a wrapper script that merges a folder containing the installation-specific collection of libraries with the folder containing the shared libraries before starting the IDE. Something like:

rm -rf "portable/sketchbook/libraries"
mkdir "portable/sketchbook/libraries"
cp --recursive "portable/sketchbook/portable-libraries" "portable/sketchbook/libraries"
cp --recursive "D:/Custom Arduino Libraries" "portable/sketchbook/libraries"

(would need to be translated to batch file or powershell script if you don't use Bash)
You'd need to make sure to put any newly installed libraries in the appropriate source folder, depending on whether you want its installation isolated to the single portable installation or be shared between all of them, but I think that would be the case no matter what.

Arduino CLI does allow any number of arbitrary libraries folders, specified via the arduino-cli compile --libraries flag:

Thanks for the on-topic reply. What I ended up doing is creating a Windows "Directory Junction" link (i.e. "mklink /J ...") in each of the "...\portable\sketchbook\libraries" locations to each of the "D:\Custom Arduino Libraries" library folders. Since this is a tedious operation, I created a simple batch file to do it.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.