Changing Default Library Location

Hi there,

As part of our set up, we need to install additional libraries that will be present on every users profile by default. We used to do this by having the files located here - C:\Program Files (x86)\Arduino\libraries which worked quite nicely, although this now no longer seems to exist? Is there any alternative to this? From what I understand, the new default path is the default sketchbook path - is there any way this can be changed via a preference file or similar so it's more of a set and forget solution? Our users do not store work locally as profiles are wiped frequently, so in an ideal world we would set this to a shared area of sorts on the hard drive

Thanks

Hi @callumplatform.

You were using Arduino IDE 1.x at that time. That is the location of the fundamental "built-in" libraries that were included in the Arduino IDE 1.x installation.

Arduino IDE 2.x still automatically installs these libraries, but uses a different approach where the latest version of the libraries are installed via the Library Manager infrastructure (so that we don't need to make a new release of the entire Arduino IDE application just to ship a new version of a library). Arduino IDE 2.x installs the libraries to the libraries subfolder of the Arduino "data folder". The "data folder" is also used to store the installations of the Arduino platforms that add support for specific boards to Arduino IDE (e.g., the "Arduino AVR Boards" platform of the UNO R3).

By default, the "data folder" is in the following location:

C:\Users\<username>\AppData\Local\Arduino15\

(Where <username> is the Windows username)

You might find this location problematic due to the fact it is a user-specific path. It is not possible to configure the location of the "built-in" libraries folder specifically, but the location of the "data folder" can be configured, and by doing so you will indirectly also configure the location of the built-in libraries folder (as well as the location of all other files that are stored in the "data folder".

The "data folder" location is configured via the directories.data key in the file at the following path:

C:\Users\<username>\.arduinoIDE\arduino-cli.yaml

You can learn more about this configuration file from the documentation here:

https://arduino.github.io/arduino-cli/latest/configuration/

For a system administration use case where you are managing numerous accounts, you might find it inconvenient to manually modify the file. This file is written in the common YAML language, so it is fairly easy to set up scripts to modify the file automatically.

The arduino-cli.yaml configuration file can be generated and the data in the file adjusted using the arduino-cli config commands:

https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_config/

For a general purpose command line tool for working with YAML, I can recommend the excellent yq:

You will find that a high quality YAML library is available for each programming language (example).