Commit 4c25e7c6 by Qiang Xue

path fix.

parent 513037d9
...@@ -85,13 +85,15 @@ class Installer extends LibraryInstaller ...@@ -85,13 +85,15 @@ class Installer extends LibraryInstaller
protected function generateDefaultAlias(PackageInterface $package) protected function generateDefaultAlias(PackageInterface $package)
{ {
$autoload = $package->getAutoload(); $autoload = $package->getAutoload();
if (!empty($autoload['psr-0'])) { if (empty($autoload['psr-0'])) {
return false;
}
$fs = new Filesystem; $fs = new Filesystem;
$vendorDir = $fs->normalizePath($this->vendorDir); $vendorDir = $fs->normalizePath($this->vendorDir);
foreach ($autoload['psr-0'] as $name => $path) { foreach ($autoload['psr-0'] as $name => $path) {
$name = str_replace('\\', '/', trim($name, '\\')); $name = str_replace('\\', '/', trim($name, '\\'));
if (!$fs->isAbsolutePath($path)) { if (!$fs->isAbsolutePath($path)) {
$path = $this->vendorDir . '/' . $path; $path = $this->vendorDir . '/' . $package->getName() . '/' . $path;
} }
$path = $fs->normalizePath($path); $path = $fs->normalizePath($path);
if (strpos($path . '/', $vendorDir . '/') === 0) { if (strpos($path . '/', $vendorDir . '/') === 0) {
...@@ -101,8 +103,6 @@ class Installer extends LibraryInstaller ...@@ -101,8 +103,6 @@ class Installer extends LibraryInstaller
} }
} }
} }
return false;
}
protected function removePackage(PackageInterface $package) protected function removePackage(PackageInterface $package)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment