Index: bin/php/ezpgenerateautoloads.php
===================================================================
--- bin/php/ezpgenerateautoloads.php	(revision 20524)
+++ bin/php/ezpgenerateautoloads.php	(working copy)
@@ -158,30 +158,30 @@
 
 function fetchFiles( $path, $mask )
 {
-    // make sure ezcFile::findRecursive and the exclusion filters we pass to it
-    // work correctly on systems with another file seperator than the forward slash
-    $sanitisedBasePath = DIRECTORY_SEPARATOR == '/' ? $path : strtr( $path, DIRECTORY_SEPARATOR, '/' );
-
     $retFiles = array();
 
+    $extensionPath = $path . DIRECTORY_SEPARATOR . 'extension';
+
     switch( checkMode( $mask) )
     {
         case EZP_GENAUTOLOADS_EXTENSION:
         {
-            $retFiles = array( "extension" => buildFileList( "$sanitisedBasePath/extension" ) );
+            $retFiles = array( "extension" => buildFileList( $extensionPath ) );
             break;
         }
 
         case EZP_GENAUTOLOADS_KERNEL:
         {
-            $retFiles = array( "kernel" => buildFileList( $sanitisedBasePath, array( "@^{$sanitisedBasePath}/extension/@" ) ) );
+            $filter = "@^" . preg_quote( $extensionPath . DIRECTORY_SEPARATOR, '@' ) . "@";
+            $retFiles = array( "kernel" => buildFileList( $path, array( $filter ) ) );
             break;
         }
 
         case EZP_GENAUTOLOADS_BOTH:
         {
-            $retFiles = array( "extension"  => buildFileList( "$sanitisedBasePath/extension" ),
-                               "kernel"     => buildFileList( $sanitisedBasePath, array( "@^{$sanitisedBasePath}/extension/@" ) ) );
+            $filter = "@^" . preg_quote( $extensionPath . DIRECTORY_SEPARATOR, '@' ) . "@";
+            $retFiles = array( "extension"  => buildFileList( $extensionPath ),
+                               "kernel"     => buildFileList( $path, array( $filter ) ) );
             break;
         }
     }
@@ -191,12 +191,6 @@
     {
         foreach ( $fileBundle as $key => &$file )
         {
-            // ezcFile::calculateRelativePath only works correctly with paths where DIRECTORY_SEPARATOR is used
-            // so we need to correct the results of ezcFile::findRecursive again
-            if ( DIRECTORY_SEPARATOR != '/' )
-            {
-                $file = strtr( $file, '/', DIRECTORY_SEPARATOR );
-            }
             $fileBundle[$key] = ezcFile::calculateRelativePath( $file, $path );
         }
     }
@@ -206,7 +200,7 @@
 
 function buildFileList( $path, $extraFilter = null )
 {
-    $exclusionFilter = array( "@^{$path}/(var|settings|benchmarks|autoload|port_info|templates|tmp)/@" );
+    $exclusionFilter = array( "@^" . preg_quote( $path . DIRECTORY_SEPARATOR, '@' ) . "(var|settings|benchmarks|autoload|port_info|templates|tmp)" . preg_quote( DIRECTORY_SEPARATOR, '@' ) . "@" );
     if ( !empty( $extraFilter ) and is_array( $extraFilter ) )
     {
         foreach( $extraFilter as $filter )
