Library Location should be separable from sketch location

In IDE 1.x, I could effectively set my sketch location to a different location from the libraries. With IDE 2.1.1 I am unable to do so - after my install of 2.1.1 I changed my sketch location, and now it sees no libraries. I know how to "fix" it, but really there is room for improvement here:

Reasons they should be separable:

  • Allows managing multiple releases and multiple groupings of libraries
  • Allows multiple users to share libraries
  • Allows doing risk free testing and upgrades
  • Allows one to manage libraries by having different library versions that MIGHT be required
    when using two different IDE versions owing to compiler differences.

Suggested remedy: In preferences have a field for one (or even more) locations for libraries. Perhaps with a notice that if one installs a library from inside the IDE it will always go into the first location specified.

For now, I have to change you default sketch location, and navigate to my regular sketch location EVERY TIME I open a different file (other than the last one that was already open, of course). Annoying. (I will probably copy my existing D:\Users\Jay\Documents\Arduino folder to Arduino2 so they don't try and share libraries, as well.)

[The same issue could potentially exist for board files, I suppose, as well.]

JRJ

Hi @cube1us

Please provide a detailed description of how you accomplished that.

All I did under the IDE 1.8.xx was to change the Sketch location to D:\Users\Jay\Arduino - but that did NOT cause it to change the library location - it left that alone at D:\Users\Jay\Documents\Arduino\libraries (rather than moving it to C:\Users\Jay\Arduino where I keep my sketches.

JRJ

I think you must be misremembering. Arduino IDE 1.x and 2.x work exactly the same in this respect. User-installed libraries are always stored under the libraries subfolder of the path configured via the "Sketchbook location" field in the Arduino IDE preferences.

Libraries are also stored in several other locations on your computer. The fundamental "built-in" libraries (e.g., "Servo", "Mouse", "Keyboard") were stored under the libraries subfolder of the Arduino IDE 1.x installation folder, so I suppose the behavior you describe could be possible if you had Arduino IDE installed at D:\Users\Jay\Documents\Arduino.

It turns out I was relying on the library managers behavior to tell me whether it was working or not. So, when I got your note I checked further. While under the scenario I described on 1.18.18 compiles do indeed fail when set up as I discussed, but the library manager shows the libraries just fine (not just the built-ins, but ALL of them) - so that misled me - no remembering was involved. Under IDE 2 under this scenario, the library manager shows no libraries at all. I just verified this - no "remembering" involved.

Anyway, my 1.18.18 IDE is installed a P:\PRO\Arduino. IDE 2 is in P:\Pro\Arduino2

Regardless, my suggestion stands: It would be much better to be able to specify a different folder (and even a different drive) for libraries as opposed to sketches for all of the reasons I listed, and more. For example, I'd much rather the libraries be on my P: (for products) SSD, but I like to keep my changing data (like sketches) on spinning, RAID magnetics.

JRJ

If you have the "Type" filter menu set to "All" in the Arduino IDE 2.x Library Manager, you should definitely see all 5000+ libraries listed. If you have the filter set to something else (e.g., "Installed") then that could definitely cause the Library Manager to list no libraries after you change the sketchbook location preference.

Please note that, although libraries must be installed in a specific location in order to be recognized by Arduino IDE, you are free to store your sketches anywhere you like. The sketchbook folder is only a convenient location to store sketches in that it causes them to be listed in the File > Sketchbook menu and in the "SKETCHBOOK" view. But those are only convenience features. You can open sketches from any location via File > Open or file association.

Of course, yes, I was using the Installed filter.

Yes, I was well aware that you can put sketches anywhere - I have been doing so for years. :wink:

Regardless, my suggestion still stands - would like to have better library management.

(And, BTW, it would be nice to be able to filter the board files using "Installed" as well. :wink:

JRJ

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