From 5822b58c1f9118aecf5d07be0fb7664e0fde1477 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 1 Apr 2016 11:31:39 +0100 Subject: [PATCH] Avoid using realpath when generating classmap, speeds up generation and keeps paths local to project in case of symlinks/path repo --- src/Composer/Autoload/ClassMapGenerator.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index b0b1616c3..704d6b39f 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -20,6 +20,7 @@ namespace Composer\Autoload; use Symfony\Component\Finder\Finder; use Composer\IO\IOInterface; +use Composer\Util\Filesystem; /** * ClassMapGenerator @@ -73,14 +74,20 @@ class ClassMapGenerator } $map = array(); + $filesystem = new Filesystem(); + $cwd = getcwd(); foreach ($path as $file) { - $filePath = $file->getRealPath(); - + $filePath = $file->getPathname(); if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) { continue; } + if (!$filesystem->isAbsolutePath($filePath)) { + $filePath = $cwd . '/' . $filePath; + $filePath = $filesystem->normalizePath($filePath); + } + if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) { continue; }