1
0
Fork 0

Lazy-init the bin directory, fixes #364

pull/501/head
Jordi Boggiano 2012-03-26 01:26:09 +02:00
parent 20421931b0
commit 583a0b5f0d
1 changed files with 9 additions and 4 deletions

View File

@ -78,7 +78,7 @@ class LibraryInstaller implements InstallerInterface
*/
public function install(PackageInterface $package)
{
$this->initializeDirs();
$this->initializeVendorDir();
$downloadPath = $this->getInstallPath($package);
// remove the binaries if it appears the package files are missing
@ -102,7 +102,7 @@ class LibraryInstaller implements InstallerInterface
throw new \InvalidArgumentException('Package is not installed: '.$initial);
}
$this->initializeDirs();
$this->initializeVendorDir();
$downloadPath = $this->getInstallPath($initial);
$this->removeBinaries($initial);
@ -147,6 +147,7 @@ class LibraryInstaller implements InstallerInterface
return;
}
foreach ($package->getBinaries() as $bin) {
$this->initializeBinDir();
$link = $this->binDir.'/'.basename($bin);
if (file_exists($link)) {
if (is_link($link)) {
@ -196,11 +197,15 @@ class LibraryInstaller implements InstallerInterface
}
}
protected function initializeDirs()
protected function initializeVendorDir()
{
$this->filesystem->ensureDirectoryExists($this->vendorDir);
$this->filesystem->ensureDirectoryExists($this->binDir);
$this->vendorDir = realpath($this->vendorDir);
}
protected function initializeBinDir()
{
$this->filesystem->ensureDirectoryExists($this->binDir);
$this->binDir = realpath($this->binDir);
}