Where are the libraries? and best place outside of my profile for libraries?

On Arduino.cc it says "Arduino libraries are managed in three different places, but doesn't provide a file-path for them. These locations were discovered after a couple hours of googling:

  1. My profile - (default - not available to a different person who logs on. not available if I log on to a different computer.)
    C:\Users\userName\Documents\Arduino\libraries

  2. IDE installation folder - (libraries added here will be removed with next IDE upgrade.)
    C:\Program Files (x86)\Arduino\libraries

  3. Libraries folder inside your sketchbook - (not available to other sketches.)
    C:\Users\userName\Documents\Arduino\sketchName\libraries

first question: Are these the three locations hinted at on Arduino.cc?

second question: How can a location be defined that the IDE will check no matter who logs on and won't disappear with each IDE upgrade?

third question: Can such a folder be created on a network, perhaps with a mapped drive?

I thank you for your considerate explanations.

fourth question: What is the precedence order of Library folders?

Your optionally installed libs live at "C:\Users\userName\Documents\Arduino\libraries" plain and simple. The rest of the built-in lib code is in the Arduino Core (pretty much the installation folder - kinda).

I could be wrong, but I think the order of precedence is Core, Documents folder, and then sketch folder.

Why do you ask?

ocuser:
first question: Are these the three locations hinted at on Arduino.cc?

Those are two of the three. You got mixed up on the sketchbook libraries and sort of listed that one twice. The sketchbook libraries are installed to the libraries subfolder of your sketchbook folder. The sketchbook folder is shown/configured in the Arduino IDE's File > Preferences > Skectchbook location setting. With (3), you seem to be implying that libraries can be placed in a libraries subfolder of a sketch folder, but this is not supported.

The third location is the libraries subfolder of the currently selected board's platform. Location will depend on if you're using a hardware core bundled with the IDE, installed via Boards Manager, or manually installed to {sketchbook folder}/hardware. The best way to find it is to do:

  • File > Examples > SPI > BarometricPressureSensor (or any other SPI library example sketch)
  • Sketch > Show Sketch Folder - this will open the SPI/examples/BarometricPressureSensor folder inside of the current hardware core's libraries folder

The libraries bundled with a platform are only accessible to your sketch when you are compiling for a board of that platform.

ocuser:
second question: How can a location be defined that the IDE will check no matter who logs on and won't disappear with each IDE upgrade?

As I said above, the sketchbook location can be modified in your preferences. However, when the Arduino IDE is running in normal mode, the preferences are stored under your user folder. The way to work around that is to run the Arduino IDE in portable mode:

Windows 10 is very restrictive of the C:\Program Files and C:\Program Files (x86) folders, so you should use the "Windows ZIP file for non admin install" version of the Arduino IDE and install it to a location outside of those folders.

After this, the preferences will be stored under the portable folder of the Arduino IDE, thus every user will share the same preferences and the same sketchbook location. By default, when running in portable mode, the sketchbook will be located under the portable folder, meaning it could be lost when you update the IDE if you didn't remember to move the portable folder first. However, you can change the sketchbook folder location in File > Preferences to somewhere safe.

ocuser:
third question: Can such a folder be created on a network, perhaps with a mapped drive?

Yes, but there have been some reports of this making the IDE slow or not start if the drive is offline. I'm not sure exactly what the conditions are or whether it's restricted to specific IDE versions, but it's something to keep in mind in case you end up having problems after doing that.

Power_Broker:
I think the order of precedence is Core, Documents folder, and then sketch folder.

It's not quite so simple. The library dependency resolution process is documented here:
https://arduino.github.io/arduino-cli/sketch-build-process/#dependency-resolution

pert:
The third location is the libraries subfolder of the currently selected board's platform. Location will depend on if you're using a hardware core bundled with the IDE, installed via Boards Manager, or manually installed to {sketchbook folder}/hardware. The best way to find it is to do:

  • File > Examples > SPI > BarometricPressureSensor

(or any other SPI library example sketch)

  • Sketch > Show Sketch Folder - this will open the SPI/examples/BarometricPressureSensor folder inside of the current hardware core's libraries folder

Thank you for the detailed reply. I pointed preferences to a network drive and it is working well. I didn't understand about the third location for libraries. Can you provide an example file-path for a board platform?

ocuser:
Can you provide an example file-path for a board platform?

C:\Program Files (x86)\Arduino\hardware\arduino\avr

However, you should be aware that this is not the normal location for platforms to be installed. The Arduino IDE comes with a bundled copy of the Arduino AVR Boards platform, but when you install any other platform, or even update Arduino AVR Boards, it is installed to a different location. If you have another copy of Arduino AVR Boards installed, the one bundled with the Arduino IDE will no longer be used. This is why I gave you the instructions for finding the location. If you follow those locations, then you will always be able to find the location of the active platform.