Commit 4c25e7c6 by Qiang Xue

path fix.

parent 513037d9
...@@ -85,23 +85,23 @@ class Installer extends LibraryInstaller ...@@ -85,23 +85,23 @@ 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'])) {
$fs = new Filesystem; return false;
$vendorDir = $fs->normalizePath($this->vendorDir); }
foreach ($autoload['psr-0'] as $name => $path) { $fs = new Filesystem;
$name = str_replace('\\', '/', trim($name, '\\')); $vendorDir = $fs->normalizePath($this->vendorDir);
if (!$fs->isAbsolutePath($path)) { foreach ($autoload['psr-0'] as $name => $path) {
$path = $this->vendorDir . '/' . $path; $name = str_replace('\\', '/', trim($name, '\\'));
} if (!$fs->isAbsolutePath($path)) {
$path = $fs->normalizePath($path); $path = $this->vendorDir . '/' . $package->getName() . '/' . $path;
if (strpos($path . '/', $vendorDir . '/') === 0) { }
return ["@$name" => '<vendor-dir>' . substr($path, strlen($vendorDir)) . '/' . $name]; $path = $fs->normalizePath($path);
} else { if (strpos($path . '/', $vendorDir . '/') === 0) {
return ["@$name" => $path . '/' . $name]; return ["@$name" => '<vendor-dir>' . substr($path, strlen($vendorDir)) . '/' . $name];
} } else {
return ["@$name" => $path . '/' . $name];
} }
} }
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