Fixed creating shortest paths in AutoloadGenerator
parent
fde38dacec
commit
afc04c9e53
|
@ -58,7 +58,7 @@ EOF;
|
||||||
|
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
$vendorPath = strtr(realpath($installationManager->getVendorPath()), '\\', '/');
|
$vendorPath = strtr(realpath($installationManager->getVendorPath()), '\\', '/');
|
||||||
$relVendorPath = $filesystem->findShortestPath(getcwd(), $vendorPath);
|
$relVendorPath = $filesystem->findShortestPath(getcwd().'/inDir', $vendorPath);
|
||||||
$vendorDirCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
|
$vendorDirCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
|
||||||
|
|
||||||
$appBaseDir = $filesystem->findShortestPathCode($vendorPath, getcwd(), true);
|
$appBaseDir = $filesystem->findShortestPathCode($vendorPath, getcwd(), true);
|
||||||
|
@ -85,11 +85,7 @@ EOF;
|
||||||
$path = strtr($path, '\\', '/');
|
$path = strtr($path, '\\', '/');
|
||||||
$baseDir = '';
|
$baseDir = '';
|
||||||
if (!$filesystem->isAbsolutePath($path)) {
|
if (!$filesystem->isAbsolutePath($path)) {
|
||||||
// vendor dir == working dir
|
if (strpos($path, $relVendorPath) === 0) {
|
||||||
if (preg_match('{^(\./?)?$}', $relVendorPath)) {
|
|
||||||
$path = '/'.$path;
|
|
||||||
$baseDir = '$vendorDir . ';
|
|
||||||
} elseif (strpos($path, $relVendorPath) === 0) {
|
|
||||||
// path starts with vendor dir
|
// path starts with vendor dir
|
||||||
$path = substr($path, strlen($relVendorPath));
|
$path = substr($path, strlen($relVendorPath));
|
||||||
$baseDir = '$vendorDir . ';
|
$baseDir = '$vendorDir . ';
|
||||||
|
@ -129,7 +125,7 @@ EOF;
|
||||||
$autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap']));
|
$autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap']));
|
||||||
foreach ($autoloads['classmap'] as $dir) {
|
foreach ($autoloads['classmap'] as $dir) {
|
||||||
foreach (ClassMapGenerator::createMap($dir) as $class => $path) {
|
foreach (ClassMapGenerator::createMap($dir) as $class => $path) {
|
||||||
$path = '/'.$filesystem->findShortestPath(getcwd(), $path);
|
$path = '/'.$filesystem->findShortestPath(getcwd().'/inDir', $path);
|
||||||
$classmapFile .= ' '.var_export($class, true).' => $baseDir . '.var_export($path, true).",\n";
|
$classmapFile .= ' '.var_export($class, true).' => $baseDir . '.var_export($path, true).",\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue