fixes a bug when root package has a 'files' autoload entry

main
Johannes M. Schmitt 12 years ago
parent ac29308eb7
commit 9f150b1c1e

@ -127,6 +127,10 @@ EOF;
$filesCode = "";
$autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
foreach ($autoloads['files'] as $functionFile) {
if ( ! $filesystem->isAbsolutePath($functionFile)) {
$functionFile = dirname($vendorPath) . '/'. $functionFile;
}
$filesCode .= ' require __DIR__ . '. var_export('/'.$filesystem->findShortestPath($vendorPath, $functionFile), true).";\n";
}
@ -181,6 +185,7 @@ EOF;
if (!is_array($mapping)) {
continue;
}
foreach ($mapping as $namespace => $paths) {
foreach ((array) $paths as $path) {
$autoloads[$type][$namespace][] = empty($installPath) ? $path : $installPath.'/'.$path;

@ -64,7 +64,7 @@ class Filesystem
public function findShortestPath($from, $to, $directories = false)
{
if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
throw new \InvalidArgumentException('from and to must be absolute paths');
throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
}
$from = lcfirst(rtrim(strtr($from, '\\', '/'), '/'));
@ -105,7 +105,7 @@ class Filesystem
public function findShortestPathCode($from, $to, $directories = false)
{
if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
throw new \InvalidArgumentException('from and to must be absolute paths');
throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
}
$from = lcfirst(strtr($from, '\\', '/'));

Loading…
Cancel
Save