Avoid using realpath when generating classmap, speeds up generation and keeps paths local to project in case of symlinks/path repo
parent
e5813d06ae
commit
5822b58c1f
|
@ -20,6 +20,7 @@ namespace Composer\Autoload;
|
||||||
|
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
use Composer\IO\IOInterface;
|
use Composer\IO\IOInterface;
|
||||||
|
use Composer\Util\Filesystem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClassMapGenerator
|
* ClassMapGenerator
|
||||||
|
@ -73,14 +74,20 @@ class ClassMapGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
$map = array();
|
$map = array();
|
||||||
|
$filesystem = new Filesystem();
|
||||||
|
$cwd = getcwd();
|
||||||
|
|
||||||
foreach ($path as $file) {
|
foreach ($path as $file) {
|
||||||
$filePath = $file->getRealPath();
|
$filePath = $file->getPathname();
|
||||||
|
|
||||||
if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
|
if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$filesystem->isAbsolutePath($filePath)) {
|
||||||
|
$filePath = $cwd . '/' . $filePath;
|
||||||
|
$filePath = $filesystem->normalizePath($filePath);
|
||||||
|
}
|
||||||
|
|
||||||
if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
|
if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue