Each board type that you install, ie AVR, ESP32 etc may have board specific libraries, even libraries of the same name as for other boards
So, the IDE starts its library search in those board files. My ESP32 board library files are in C:\Users\Bob2\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.15\libraries
NOTE - this is Windows but I assume that that something similar exists on the Mac
If the compiler does not find a required library in the board specific location it then looks in the libraries folder of the Sketchbook folder. This folder holds libraries installed using the IDE Library Manager
As an alternative you can put library files in the same folder as the sketch and use the alternative form of #include, ie #include "libraryName,h" instead of #include <libraryName,h> This forces the compiler to look for the library in the sketch folder before moving on to do the normal search
No, this can't be it. There must be a way to install libraries of special versions local to the project without interfering with the standard libraries being installed in the standard folder under Arduino/libraries.
The project I downloaded from the author's site has the structure as I described in my initial post.
The respective libraries were all stored in ../libraries (relative to the folder with the .ino in it). What a mess that would produce when I put all header files into the same directoy as the .ino file.
// library is in the same directory as the sketch
#include "mylib.h"
// library is in the src subdirectory of the sketch
#include "src/mylib/mylib.h"
If the library can not be found, the library search path will be extended with the below
sketchbook / libraries.
package / libraries for the bundled libraries (e.g. Servo or LiquidCrystal).
package / core / libraries for system libraries like EEPROM or SPI.
Note that if you make a copy of a library in (2) and (3) above in the sketchbook / libraries directory, that copy will be used. So that is one way to override the default libraries.