Puzzled about libraries

My reply appears to have vanished while I was composing it, probably finger trouble on my part, so apologies if a similar one turns up. Roughly this:


Thanks a lot, much appreciate your taking the time on such a detailed explanation.

I'll be doing more copying to the shed PC so I'm curious if there's a way to determine the folder location of a newly installed 'contributed' library within the IDE itself. Instead of using other tools as I did for Time and TimeAlarms today? Manage Libraries didn't help. I thought More info would, but that just displays a page headed "Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post"

I'm curious if there's a way to determine the folder location of a newly installed 'contributed' library within the IDE itself

As has been explained, unless you expressly put them somewhere else they will be in the libraries folder of your sketchbook folder

Terrypin:
My reply appears to have vanished while I was composing it

The forum software periodically saves drafts of your post while you're writing it, so you can sometimes rescue it by going to the "Drafts" section of your forum settings:
https://forum.arduino.cc/index.php?action=profile;area=showdrafts;u=1221632

And, no even as a moderator I can't see your drafts. I just know what the URL is by inserting your user number into the standard URL format.

Terrypin:
Thanks a lot, much appreciate your taking the time on such a detailed explanation.

You're welcome. I'm glad if I can be of assistance.

Terrypin:
I'm curious if there's a way to determine the folder location of a newly installed 'contributed' library within the IDE itself.

Do this:
File > Preferences
Check the box next to "Show verbose output during: compilation".
Click the "OK" button.
Compile any sketch that has an #include directive for the library. It can just be a bare minimum sketch.
After compilation finishes, look at the contents of the black console pane at the bottom of the Arduino IDE window. You should see something like this:

Using library Time at version 1.6.0 in folder: C:\Users\terry\Dropbox\Electronics\Arduino\SKETCHES\libraries\arduino_293683

This output is especially useful when you have multiple libraries installed that have a file matching the #include directive because, in addition to showing the location of the library that was used, it also shows the locations of the libraries that weren't used.

Terrypin:
I thought More info would, but that just displays a page headed "Arduino Playground is read-only starting December 31st, 2018. For more info please look at this Forum Post"

This link goes to whatever URL the library author specified in the library metadata:

In the case of the Time library, its original home was the Arduino Playground back in the olden days and its URL reflects the origin of the library.

UKHeliBob:
As has been explained, unless you expressly put them somewhere else they will be in the libraries folder of your sketchbook folder

Yes, but the name is not identified, as shown in the example of Time We discussed. I was asking for a way to get ‘arduino_293683’ from ‘Time.h’

The method described by @pert reveals that location. As did the more tedious use of File Explorer and other search tools, fed with appropriate clues.

This "arduino_293683" thing should happen only rarely.

An example of what could cause it is updating a library while you have one of the files open in another program. Because the previous copy of the folder is in use, Library Manager can't delete it, so the installation remains in that randomly named staging folder.

This "arduino_293683" thing should happen only rarely.

I don't think that it should happen ever. If the library cannot be installed in the standard location or in a user specified location then the installation should fail. Anything else leads to confusion as illustrated in this thread

I hadn't realised there might be something special about my library names until this latest interesting turn in the discussion. I'd just assumed it was a surprisingly poor design aspect of the IDE. But as you see, many of my libraries have that unhelpful form.

Could someone please post their own list (image or text) to provide a helpful mapping to mine?

Leaving aside the question of how these names arose, is there a simple and safe way for me to restore meaningful names, which from your comments I assume are the norm?

is there a simple and safe way for me to restore meaningful names, which from your comments I assume are the norm?

The normal naming scheme would be to have a library named LibraryName in a folder named LibraryName in the libraries folder of your sketchbook and for that folder to contain LibraryName.h and probably LibraryName.cpp along with any supporting files needed by the library

What do you see when you open one of the randomly named library folders ? What happens if you close the IDE and rename the folder to match that of the files it contains ?

Make backups before experimenting !

Could someone please post their own list (image or text) to provide a helpful mapping to mine?

four of my folders have also have trailing numbers.
But honestly, I don't care. The name of the library in the IDE comes from the library.properties and I have seen no negative effect so far, for these folder naming.

If you can't live with that:
close the IDE,
move the folder to another backup place not within your Arduino file structure.
open the IDE
reinstall the Library using the library manager

Check, in the file system what happend.

Terrypin:
I hadn't realised there might be something special about my library names until this latest interesting turn in the discussion. I'd just assumed it was a surprisingly poor design aspect of the IDE. But as you see, many of my libraries have that unhelpful form.

That is certainly unusual. I get it every once in a while (note that I install a LOT of libraries due to my support and testing work), but it's usually for the understandable access denial reason I explained in my previous reply. I have a suspicion this could be caused by your antivirus software interfering with the Arduino Library Manager. I also see the "dropbox" and wonder if that could be related.

Terrypin:
Could someone please post their own list (image or text) to provide a helpful mapping to mine?

I don't think there could be any meaningful mapping because everyone has different libraries.

Terrypin:
Leaving aside the question of how these names arose, is there a simple and safe way for me to restore meaningful names, which from your comments I assume are the norm?

I explained the Library Manager folder naming system in my earlier reply. You can replicate that manually if you like.

noiasca:
I have seen no negative effect so far, for these folder naming.

It is possible, but only in very specific circumstances.

When multiple libraries are installed that contain a header file matching an #include directive, the Arduino build system has to decide which of the libraries to use. There is a well defined system of how the priorities are determined:
https://arduino.github.io/arduino-cli/latest/sketch-build-process/#dependency-resolution

"Folder name priority" is one of the factors. So if you have an #include directive for Servo.h and the library folder is named "Servo", that library gets the highest folder name priority score. If the folder is instead named arduino_12345, that library gets the lowest folder name priority score. So this can make the difference between whether that library is selected over others or not.

You will most often only have one library that matches the #include directive, in which case this isn't an issue. When there are multiple libraries, the Arduino IDE (etc.) will print a message in the console pane telling you about this and showing the location of all the libraries. So you only need to worry about it if a different library from the one you intended was chosen.

UKHeliBob:
The normal naming scheme would be to have a library named LibraryName in a folder named LibraryName in the libraries folder of your sketchbook and for that folder to contain LibraryName.h and probably LibraryName.cpp along with any supporting files needed by the library

I’d describe that as ‘desirable’ but are you really saying it’s ‘normal’? Is it what your \libraries folder looks like? A screenshot would be good.

Except when this staging folder thing happens, Library Manager always installs libraries to a folder that is named according to the value of the name field you'll find the the library.properties file in the root of each library folder, but with spaces replaced with _. So if the library name was "Terrypin awesome library", the folder name is "Terrypin_awesome_library".

That name value is also the name shown in the Library Manager GUI.

The library author can set the name value to anything they like (as long as it doesn't use prohibited characters), so there is no guarantee the library folder will match the primary header filename. It is true that naming the header file/library in that manner is a common practice, as well as being best practices due to the "folder name priority" thing I explained above.

In the case of libraries installed via the "Add .ZIP library" feature or manually, you will often see the folder name ending in "-master". This is so common, there's even special handling of this case in the "folder name priority" rules. The reason for this is that most libraries are hosted on GitHub and GitHub appends the Git ref to the folder name of the .zip download. Most people end up downloading from the tip of the default branch (because this is what you get from the repository home page). GitHub's default name for the default branch is currently "master" (though that's going to change to "main" soon due to it being considered a more inclusive term), hence the "-master".

Anyway, all this is interesting to talk about, and can be useful information, but I hope you won't let it confuse or sidetrack you. It's likely you can just copy over all the folders in your libraries folder to the "shed computer" and everything will work just fine.

I'd describe that as 'desirable' but are you really saying it's 'normal'?

Yes, I am saying that it is normal

I currently have 119 user contributed libraries in the sketchbook/libraries folder and all but one of them has the normal name structure as described previously. The exception contains the Adafruit_GFX library but there is also an explicitly named folder that contains the same library and yet another named AdafruitGFXLibrarymaster which appears to contain a very much older version

Thanks, I'm envious! It's now a question of what wins: my impatience to solve the puzzle of getting normal naming, or my fear of screwing things up.

pert:
...It's likely you can just copy over all the folders in your libraries folder to the "shed computer" and everything will work just fine.

Thanks, mostly understood, and final para reassuring!

Uncomfortable with unsolved puzzles as I am, I'll probably return to this later and try to get my library names back to normal meaningful form.

I'm envious!

Feel free to install as many libraries as you like