From 4c25e7c6ce8dc68f39720e54d6f22134dd6331df Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 2 Nov 2013 23:33:00 -0400 Subject: [PATCH] path fix. --- extensions/composer/Installer.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/extensions/composer/Installer.php b/extensions/composer/Installer.php index a449c6d..fb0b683 100644 --- a/extensions/composer/Installer.php +++ b/extensions/composer/Installer.php @@ -85,23 +85,23 @@ class Installer extends LibraryInstaller protected function generateDefaultAlias(PackageInterface $package) { $autoload = $package->getAutoload(); - if (!empty($autoload['psr-0'])) { - $fs = new Filesystem; - $vendorDir = $fs->normalizePath($this->vendorDir); - foreach ($autoload['psr-0'] as $name => $path) { - $name = str_replace('\\', '/', trim($name, '\\')); - if (!$fs->isAbsolutePath($path)) { - $path = $this->vendorDir . '/' . $path; - } - $path = $fs->normalizePath($path); - if (strpos($path . '/', $vendorDir . '/') === 0) { - return ["@$name" => '' . substr($path, strlen($vendorDir)) . '/' . $name]; - } else { - return ["@$name" => $path . '/' . $name]; - } + if (empty($autoload['psr-0'])) { + return false; + } + $fs = new Filesystem; + $vendorDir = $fs->normalizePath($this->vendorDir); + foreach ($autoload['psr-0'] as $name => $path) { + $name = str_replace('\\', '/', trim($name, '\\')); + if (!$fs->isAbsolutePath($path)) { + $path = $this->vendorDir . '/' . $package->getName() . '/' . $path; + } + $path = $fs->normalizePath($path); + if (strpos($path . '/', $vendorDir . '/') === 0) { + return ["@$name" => '' . substr($path, strlen($vendorDir)) . '/' . $name]; + } else { + return ["@$name" => $path . '/' . $name]; } } - return false; } protected function removePackage(PackageInterface $package)