Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing Libraries in subfolders #1986

Conversation

matthijskooijman
Copy link
Collaborator

These commits make the IDE handle libraries inside subfolders in your sketchbook. e.g., this makes the following layout work:

Sketchbook/
    libraries/
        FastLed/
        RF22/
        Displays/
            LiquidCrystal_I2C
            UTFT
            UTouch

e.g., allows putting a few display related displayes inside a
subdirectory. This same structure is also shown in the "Import library"
menu. Furthermore, the various library sources (generic IDE libraries,
hardware-specific libraries, user libraries) are now also shown as
submenus. I'm not sure if the actual names for the categories I've used
are the best ones, though.

See below for how that looks (different example than above):

screenshot from 2014-04-04 17 42 06

@matthijskooijman
Copy link
Collaborator Author

w00ps, pressed enter to soon. Just edited in a proper title and description :-)

@matthijskooijman matthijskooijman changed the title Storing Libraries in Storing Libraries in subfolders Apr 4, 2014
@damellis
Copy link
Contributor

damellis commented Apr 4, 2014

I know a long, scrolling library menu is a pain, but I think extra sub-menus (i.e. for the various library locations) are even worse.

@matthijskooijman
Copy link
Collaborator Author

Hmm, I'd rather have nested menus with a bit of structure than scrolling menu, but I guess that's a matter of personal preference.

However, one (some what more objective?) advantage of having submenus is that you can actuall add a bit of information and tell the users where libraries come from (if we think that is a feature, I'd say it is).

In any case, I'm not particularly attached to the submenu layout, I usually just type my includes manually anyway. If consensus will be to have a single long menu, I'll change the code to accomodate that.

What do others prefer?

@mikaelpatel
Copy link

I would prefer the library configuration as a separate window with import selection. The whole menu idea will get out of hand very quickly.

Cheers!

@peabo7
Copy link

peabo7 commented Apr 5, 2014

I would prefer the library configuration as a separate window with import selection.

I like this idea too. Hovering over an item ought to display selected information from library.properties, and intermediate directories could also have a library.properties file with suitable metadata.

Peter Olson

@matthijskooijman
Copy link
Collaborator Author

I would prefer the library configuration as a separate window with import selection. The whole menu idea will get out of hand very quickly.

Sounds like a cool plan, but that's certainly out of scope for this pullrequest (probably the library manager feature that the dev team was working on will add something like this).

@damellis
Copy link
Contributor

damellis commented Apr 5, 2014

One approach that Processing uses (and I like) is to use a menu separator, followed by a disabled menu item that serves as a heading / label for the following items. See, for example:
processing import library menu

@mikaelpatel
Copy link

I think UECIDE has the solution I was looking for. Looks a bit like the plugin manager for Firefox.
http:https://www.uecide.org/forum/viewtopic.php?f=9&t=167

Cheers!

@matthijskooijman
Copy link
Collaborator Author

I've rebased this pullrequest onto the latest ide-1.5.x branch.

Also, I've added one more commit that implements the suggestion by David, to replace the top level of submenus with a separator and disabled item. Note that any actual subdirectories in the libraries directory are still shown as submenus now (but this is not visible in the screenshots below).

I'm not sure I like it much, since my lis of libraries is more than two screens long, but if people think this is easier, I'll not object.

examples
libraries

@cmaglie, perhaps you can pick either of these approaches and merge them? We can always implement something more complicated later, I'm mostly interested in getting libraries in subdirectories working, without caring overly much with how it looks.

@VisualMicro
Copy link

I think adding support for groups of libraries is a good idea as long as the group has a clear name.

Whilst it is confusing to have too many places to look for libraries it does make support much easier. When a user has multiple copies of the same named library it will be clear which one is being used.

@cmaglie cmaglie added this to the Release 1.5.8 milestone Jul 15, 2014
@matthijskooijman matthijskooijman added Component: Compilation Related to compilation of Arduino sketches Component: IDE The Arduino IDE feature request A request to make an enhancement (not a bug fix) Version: 1.5.x labels Sep 10, 2014
@cmaglie cmaglie modified the milestones: Release 1.5.8, Release 1.5.9 Oct 13, 2014
This shouldn't change any behaviour, just restructures the code to
prepare for upcoming changes.
This allows checking a folder on disk to see if it looks like a library.
This prepares for a next change by making it easier to call
Library.create from multiple places without having to copy the name
check to every invocation.

The name check is still performed in the same code paths. However,
previously it would display a warning dialog, now it just prints a
warning message in the text area (just like with other library loading
failures).
This simplifies some other code.
Previously, it was a LibraryList, but since it was only iterated, there
is no real need.

This should not change any behaviour, but prepares for an upcoming
change.
In a subsequent commit, we'll reintroduce this distinction in a more
flexible way, but for now just treat all libraries equal in the import
and examples menus.
Before, libraries could only be stored directly under
e.g. Sketchbook/libraries. When a lot of libraries were present, this
could lead to an unwieldy list in the import menu and a mess on disk.

This commit changes the library scanning code to recursively scan the
contents of the various libraries directories. Each directory is scanned
for signs of a library (library.properties file, utility folder, any .h
files). If the directory doesn't look like a library, any subdirectories
are recursively scanned.

This commit updates the scanning code and the modifies the LibraryList
class so it can store a tree of libraries instead of just a flat list.

In the GUI all libraries are still shown in a flat list.
@cmaglie cmaglie modified the milestones: Release 1.6.0, Release 1.6.1 Feb 18, 2015
@cmaglie cmaglie added Component: IDE user interface The Arduino IDE's user interface and removed Component: IDE The Arduino IDE labels Apr 15, 2015
@ffissore ffissore self-assigned this May 12, 2015
@ffissore ffissore modified the milestones: Release 1.6.1, Release 1.6.5 May 20, 2015
@ffissore ffissore modified the milestones: Release 1.6.5, Release 1.6.6 Jun 15, 2015
@ffissore ffissore removed this from the Release 1.6.6 milestone Sep 17, 2015
@lmihalkovic
Copy link

@mikaelpatel I think I am going to pursue the direction you point, rather than try to find yet-another-clever-way to cram more info into the menus (#4077 might be where I start)

@lmihalkovic
Copy link

See #7524 for an alternative way to look at this issue

@per1234
Copy link
Collaborator

per1234 commented Apr 30, 2018

@lmihalkovic #7524 is completely unrelated. This PR provides a way to organize your {sketchbook}/libraries folder with subfolders. #7524 is (vaguely) about adding some new method of installing libraries.

Since I'm commenting anyway, I'd like to say this functionality would be very useful to me. I install ~20 libraries a week solely to be able to compile a sketch to help someone on the Arduino Forum. It's difficult for me to clean all that stuff out of my libraries folder later without deleting any of the libraries I actually use. If I could separate those libraries into subfolders it would make the job simple. This would also help relieve the annoyance I have with Library Manager updates of IDE bundled libraries polluting my sketchbook/libraries folder.

@lmihalkovic
Copy link

@per1234 ... i like u too :) as i tried to hint, this PR offers a solution to a problem that could be eliminated by doing something else that is less costly (namely what i was describing in my last comment in the aforementioned issue). I hope the connection is clearer now

@eagl1
Copy link

eagl1 commented May 14, 2019

Actually this is what I was trying to do for a long time, I want to manage the libraries in "libraries" folder, so that I put them in groups for more easier classification for the libraries.

Like, sensors and modules libs are in a folder, displays libs in another one, my libs in another one .. etc.

@sandeepmistry
Copy link
Contributor

Hi @matthijskooijman,

Thank you for taking the time to open this pull request. However, at this time we would prefer not to go ahead with the changes you proposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Compilation Related to compilation of Arduino sketches Component: IDE user interface The Arduino IDE's user interface feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet