? p.patch
Index: libraries.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/libraries/libraries.module,v
retrieving revision 1.15
diff -u -p -r1.15 libraries.module
--- libraries.module	3 Dec 2010 23:16:38 -0000	1.15
+++ libraries.module	12 Dec 2010 06:51:36 -0000
@@ -64,7 +64,7 @@ function libraries_get_libraries() {
   // contains the name of the current profile, and we can call variable_get()
   // to determine the profile.
   if (!isset($profile)) {
-    $profile = variable_get('install_profile', 'default');
+    $profile = variable_get('install_profile', 'standard');
   }
 
   $directory = 'libraries';
@@ -95,17 +95,15 @@ function libraries_get_libraries() {
   // Retrieve list of directories.
   // @todo Core: Allow to scan for directories.
   $directories = array();
-  $nomask = array('CVS');
-  foreach ($searchdir as $dir) {
-    if (is_dir($dir) && $handle = opendir($dir)) {
-      while (FALSE !== ($file = readdir($handle))) {
-        if (!in_array($file, $nomask) && $file[0] != '.') {
-          if (is_dir("$dir/$file")) {
-            $directories[$file] = "$dir/$file";
-          }
-        }
+  $exclude = array('CVS');
+  foreach ($searchdir as $search) {
+    // glob and GLOB_ONLYDIR is a better way to replace old opendir and is_dir 
+    // checking all the time and open a stream also won't list . and ..
+    foreach(glob($search.'*', GLOB_ONLYDIR) as $dir) {
+      $dir_name = str_replace($search, '', $dir);
+      if (!in_array($dir_name, $exclude)) {
+	$directories[$dir_name] = $dir;
       }
-      closedir($handle);
     }
   }
 
@@ -129,7 +127,7 @@ function libraries_get_libraries() {
 function libraries_scan_info_files() {
   global $profile;
   if (!isset($profile)) {
-    $profile = variable_get('install_profile', 'default');
+    $profile = variable_get('install_profile', 'standard');
   }
   $config = conf_path();
 
