From 642c205c4fb074fc75000cbc32e1821fb272cdfa Mon Sep 17 00:00:00 2001 From: till Date: Tue, 3 Jul 2012 17:06:22 +0200 Subject: [PATCH 1/3] Allow absolute paths in composer.json and don't prepend them with a funny $baseDir variable. --- src/Composer/Autoload/AutoloadGenerator.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 82e223342..dda858764 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -118,8 +118,15 @@ EOF; $autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap'])); foreach ($autoloads['classmap'] as $dir) { foreach (ClassMapGenerator::createMap($dir) as $class => $path) { - $path = '/'.$filesystem->findShortestPath(getcwd(), $path, true); - $classmapFile .= ' '.var_export($class, true).' => $baseDir . '.var_export($path, true).",\n"; + + $classmapFile .= ' '.var_export($class, true) . ' => '; + + if (0 === strpos($path, dirname($vendorPath), 0)) { + // this path seems to be located within this application/package + $path = '/' . $filesystem->findShortestPath(getcwd(), $path, true); + $classmapFile .= '$baseDir . '; + } + $classmapFile .= var_export($path, true).",\n"; } } $classmapFile .= ");\n"; From d4c265fd1863fff5b5d2c27a8d00cfcccf0dcf85 Mon Sep 17 00:00:00 2001 From: till Date: Tue, 3 Jul 2012 17:09:27 +0200 Subject: [PATCH 2/3] Sorry, tabs. --- src/Composer/Autoload/AutoloadGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index dda858764..b3d9e76f2 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -123,7 +123,7 @@ EOF; if (0 === strpos($path, dirname($vendorPath), 0)) { // this path seems to be located within this application/package - $path = '/' . $filesystem->findShortestPath(getcwd(), $path, true); + $path = '/' . $filesystem->findShortestPath(getcwd(), $path, true); $classmapFile .= '$baseDir . '; } $classmapFile .= var_export($path, true).",\n"; From 2823c7885662e5b194c1c9de076180a2f1289388 Mon Sep 17 00:00:00 2001 From: till Date: Tue, 3 Jul 2012 17:06:22 +0200 Subject: [PATCH 3/3] Allow absolute paths in composer.json and don't prepend them with a funny $baseDir variable. --- src/Composer/Autoload/AutoloadGenerator.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 82e223342..b3d9e76f2 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -118,8 +118,15 @@ EOF; $autoloads['classmap'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['classmap'])); foreach ($autoloads['classmap'] as $dir) { foreach (ClassMapGenerator::createMap($dir) as $class => $path) { - $path = '/'.$filesystem->findShortestPath(getcwd(), $path, true); - $classmapFile .= ' '.var_export($class, true).' => $baseDir . '.var_export($path, true).",\n"; + + $classmapFile .= ' '.var_export($class, true) . ' => '; + + if (0 === strpos($path, dirname($vendorPath), 0)) { + // this path seems to be located within this application/package + $path = '/' . $filesystem->findShortestPath(getcwd(), $path, true); + $classmapFile .= '$baseDir . '; + } + $classmapFile .= var_export($path, true).",\n"; } } $classmapFile .= ");\n";