Index: api.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/api/api.install,v
retrieving revision 1.5.2.5
diff -u -w -B -F^f -r1.5.2.5 api.install
--- api.install	20 Oct 2007 01:39:16 -0000	1.5.2.5
+++ api.install	7 Jan 2008 18:41:20 -0000
@@ -177,6 +177,25 @@ function api_update_7() {
   return $return;
 }
 
+/**
+ * Cnange directory separator from ':' to ';' (Win32 compatibility).
+ */
+function api_update_8() {
+  $branches = db_query('SELECT directory FROM {api_branch}');
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+      $return[] = update_sql("UPDATE {api_branch} SET directory = REPLACE(directory, ':', ';')");
+      break;
+    case 'pgsql':
+      // untested
+      $return[] = update_sql("UPDATE {api_branch} SET directory = TRANSLATE(directory, ':', ';')");
+      break;
+  }
+
+  return $return;
+}
+
 function api_uninstall() {
   db_query('DROP TABLE IF EXISTS {api_branch}');
   db_query('DROP TABLE IF EXISTS {api_documentation}');
Index: api.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/api/api.module,v
retrieving revision 1.48.2.19
diff -u -w -B -F^f -r1.48.2.19 api.module
--- api.module	9 Nov 2007 05:30:08 -0000	1.48.2.19
+++ api.module	7 Jan 2008 18:41:21 -0000
@@ -953,7 +953,7 @@ function api_page_admin_form() {
       '#title' => t('Directory name'),
       '#type' => 'textfield',
       '#default_value' => $branch->directory,
-      '#description' => t('The absolute path of the directory to index. Multiple paths may be given, separated by colons, e.g.: "/mysite/drupal:/mysite/developer". <em>Note that the module will index recursively from the path given.</em>'),
+      '#description' => t('The absolute path of the directory to index. Multiple paths may be given, separated by semicolons, e.g.: "/mysite/drupal;/mysite/developer". <em>Note that the module will index recursively from the path given.</em>'),
     );
 
     $radios[$branch->branch_name] = $branch->title;
@@ -971,7 +971,7 @@ function api_page_admin_form() {
   $form['branches']['new']['directory'] = array(
     '#title' => t('Directory name'),
     '#type' => 'textfield',
-    '#description' => t('The absolute path of the directory to index. Multiple paths may be given, separated by colons, e.g.: "/mysite/drupal:/mysite/developer".'),
+    '#description' => t('The absolute path of the directory to index. Multiple paths may be given, separated by semicolons, e.g.: "/mysite/drupal;/mysite/developer".'),
   );
 
   global $base_url;
@@ -1321,23 +1321,15 @@ function api_link_name($name, $branch_na
  * Find all the files in the directories specified for a branch.
  */
 function api_scan_directories($directories) {
-  $directory_array = explode(':', $directories);
+  $directory_array = explode(';', $directories);
 
   if (count($directory_array) > 1) {
-    $directories_components = array();
-    foreach ($directory_array as $directory) {
-      $directory_components = array();
-      $parts = explode('/', $directory);
-      foreach ($parts as $part) {
-        if (strlen($part)) {
-          array_unshift($directory_components, reset($directory_components) .'/'. $part);
-        }
-      }
-      $directories_components[] = $directory_components;
-    }
-
-    $common_ancestor_components = call_user_func_array('array_intersect', $directories_components);
-    $common_ancestor = reset($common_ancestor_components);
+    // split directory strings into 1 char arrays and extract matching key-value pairs
+    $matching_chars = call_user_func_array('array_intersect_assoc', array_map('str_split', $directory_array));
+    // remove non-prefix values (non-sequential keys)
+    $common_ancestor_chars = array_intersect_key($matching_chars, range(0, count($matching_chars) - 1));
+    // join common anchestor chars and strip trailing '/'s
+    $common_ancestor = rtrim(implode('', $common_ancestor_chars), '/');
   }
   else {
     $common_ancestor = $directories;
