? drush_368992.patch
Index: drush_pm/drush_pm.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/drush_pm/Attic/drush_pm.module,v
retrieving revision 1.18.2.5
diff -u -p -r1.18.2.5 drush_pm.module
--- drush_pm/drush_pm.module	14 Nov 2008 22:01:46 -0000	1.18.2.5
+++ drush_pm/drush_pm.module	4 Feb 2009 14:02:57 -0000
@@ -510,22 +510,22 @@ function drush_pm_get_project_path($proj
     if (!isset($info['path'])  && $project != 'drupal') {
       // looks for an enabled module.
       foreach ($info['modules'] as $module => $name) {
-        if ($path = drupal_get_path('module', $module)) {
-          continue;
+        $path = drupal_get_path('module', $module);
+        // As some modules are not located in their project's root directory
+        // but in a subdirectory (e.g. all the ecommerce modules), we take the
+        // shortest path of all these modules and assume that it is the parent
+        // module path.
+        if (isset($shortest_path)) {
+          if (strlen($shortest_path) > strlen($path)) {
+            $shortest_path = $path;
+          }
+        }
+        else {
+          $shortest_path = $path;
         }
       }
-      // As some modules are not located in their project's root directory
-      // but in a subdirectory (e.g. all the ecommerce modules), we take the module's
-      // info file's path, and then move up until we are at a directory with the
-      // project's name.
-      $parts = explode('/', $path);
-      $i = count($parts) - 1;
-      $stop = array_search($project, $parts);
-      while ($i > $stop) {
-        unset($parts[$i]);
-        $i--;
-      }
-      $projects[$project]['path'] = implode('/', $parts);
+      $projects[$project]['path'] = $shortest_path;
+      unset($shortest_path);
     }
   }
   return $projects;
