protected function fetchFiles()
    {
        $path = $this->options->basePath;
        $excludeDirs = $this->handleDefaultExcludeFile();

        // make sure ezcBaseFile::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, '/' );
        $dirSep = preg_quote( DIRECTORY_SEPARATOR );

        $extraExcludeDirs = array();
        if ( $excludeDirs !== false and is_array( $excludeDirs ) )
        {
            foreach ( $excludeDirs as $dir )
            {
                $extraExcludeDirs[] = "@^{$sanitisedBasePath}{$dirSep}{$dir}@";
            }
        }

        $retFiles = array();

        $activeModes = $this->checkMode();

        foreach( $activeModes as $modusOperandi )
        {
            switch( $modusOperandi )
            {
                case self::MODE_KERNEL:
                    $extraExcludeKernelDirs = $extraExcludeDirs;
                    $extraExcludeKernelDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension@";
                    $extraExcludeKernelDirs[] = "@^{$sanitisedBasePath}{$dirSep}tests@";
                    $retFiles[$modusOperandi] = $this->buildFileList( $sanitisedBasePath, $extraExcludeKernelDirs );
                    break;

                case self::MODE_EXTENSION:
                case self::MODE_KERNEL_OVERRIDE:
                    $extraExcludeExtensionDirs = $extraExcludeDirs;
                    $extraExcludeExtensionDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension{$dirSep}[^{$dirSep}]+{$dirSep}tests@";
                    $retFiles[$modusOperandi] = $this->buildFileList( "$sanitisedBasePath/extension", $extraExcludeExtensionDirs );
                    break;

                case self::MODE_TESTS:
                    $retFiles[$modusOperandi] = $this->buildFileList( "$sanitisedBasePath/tests", $extraExcludeDirs );
                    $extraExcludeExtensionDirs = $extraExcludeDirs;
                    $extraExcludeExtensionDirs[] = "@^{$sanitisedBasePath}{$dirSep}extension{$dirSep}[^{$dirSep}]+{$dirSep}(?!tests)@";
                    $extensionTestFiles = $this->buildFileList("$sanitisedBasePath/extension", $extraExcludeExtensionDirs );
                    $retFiles[$modusOperandi] = array_merge( $retFiles[$modusOperandi], $extensionTestFiles );
                    break;

                case self::MODE_SINGLE_EXTENSION:
                    $retFiles = array( $modusOperandi => $this->buildFileList( "$sanitisedBasePath", $extraExcludeDirs ) );
                    break;
            }
        }

        //Make all the paths relative to $path
        foreach ( $retFiles as &$fileBundle )
        {
            foreach ( $fileBundle as $key => &$file )
            {
                // ezcBaseFile::calculateRelativePath only works correctly with paths where DIRECTORY_SEPARATOR is used
                // so we need to correct the results of ezcBaseFile::findRecursive again
                if ( DIRECTORY_SEPARATOR != '/' )
                {
                    $file = strtr( $file, '/', DIRECTORY_SEPARATOR );
                }
                $fileBundle[$key] = ezcBaseFile::calculateRelativePath( $file, $path );
            }
        }
        unset( $file, $fileBundle );
        return $retFiles;
    }