foreach ($directories as $dir) {
    if (file_exists($dir)) {
      $files = array_merge($files, file_scan_directory($dir, '@^[a-z0-9._-]+\.libraries\.info$@', array(
        'key' => 'name',
        'recurse' => TRUE,

for keep libraries separately in their folders


tstoeckler’s picture

Title: recursive scan in libraries directory » Scan for library info files recursively
Version: 7.x-2.0 » 7.x-2.x-dev
Category: bug » feature

It seems what you mean is that recursing the scan would allow to group libraries in separate folders. The problem with this is, that this would also mean scanning the libraries itself. So as soon as a library contains a file, this would break. Now that's not very likely to happen, but anyway it feels wrong to scan external library files in the first place. Can you make a strong case for this?

sun’s picture

Status: Active » Closed (works as designed)

The scan for .info files should not diverge from the folder/directory scan, whereas the latter can only take first-level directories into account.

Punk_UnDeaD’s picture

Now I have 16 folders with libraries
I use a separate folder for each library

if keep it one folder, will be garbage

m4tlch’s picture


tstoeckler’s picture

Priority: Normal » Minor
Status: Closed (works as designed) » Active

Just saw that people are still posting here, so temporarily re-opening.
Changing the code that scans for info files to do so recursively is not a problem technically, but as #1 and #2 try to explain we specifically do not want to do that. So if you want to group your libraries into sub-folders, there needs to be some way to tell libraries API that you've done so and how many levels deep you've grouped them. Unless somebody has an elegant proposal for doing that, I don't see this being that important.

Also maybe someone should explain (in detail) what is so annoying about not being able to group the libraries. I fail to see how that is such a problem.

tstoeckler’s picture

Status: Active » Closed (works as designed)

Closing this again after the lack of feedback.