Commit 6ab6730c by Qiang Xue

multiple alias support.

parent 4c25e7c6
...@@ -90,6 +90,7 @@ class Installer extends LibraryInstaller ...@@ -90,6 +90,7 @@ class Installer extends LibraryInstaller
} }
$fs = new Filesystem; $fs = new Filesystem;
$vendorDir = $fs->normalizePath($this->vendorDir); $vendorDir = $fs->normalizePath($this->vendorDir);
$aliases = [];
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)) {
...@@ -97,11 +98,12 @@ class Installer extends LibraryInstaller ...@@ -97,11 +98,12 @@ class Installer extends LibraryInstaller
} }
$path = $fs->normalizePath($path); $path = $fs->normalizePath($path);
if (strpos($path . '/', $vendorDir . '/') === 0) { if (strpos($path . '/', $vendorDir . '/') === 0) {
return ["@$name" => '<vendor-dir>' . substr($path, strlen($vendorDir)) . '/' . $name]; $aliases["@$name"] = '<vendor-dir>' . substr($path, strlen($vendorDir)) . '/' . $name;
} else { } else {
return ["@$name" => $path . '/' . $name]; $aliases["@$name"] = $path . '/' . $name;
} }
} }
return $aliases;
} }
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