From f0d86269930f11ce1552c51561d6afc7cf7e63f7 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 3 Dec 2011 21:20:20 +0100 Subject: [PATCH] Cleanups --- src/Composer/Installer/LibraryInstaller.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index 0435d8777..d7cc4d241 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -136,19 +136,21 @@ class LibraryInstaller implements InstallerInterface foreach ($package->getBinaries() as $bin) { $link = $this->binDir.'/'.basename($bin); if (file_exists($link)) { + echo 'Skipped installation of '.$bin.' for package '.$package->getName().', name conflicts with an existing file'; continue; } + $bin = $this->getInstallPath($package).'/'.$bin; if (defined('PHP_WINDOWS_VERSION_BUILD')) { // add unixy support for cygwin and similar environments if ('.bat' !== substr($bin, -4)) { - file_put_contents($link, $this->generateUnixyProxyCode($this->getInstallPath($package).'/'.$bin)); + file_put_contents($link, $this->generateUnixyProxyCode($bin, $link)); chmod($link, 0777); $link .= '.bat'; } - file_put_contents($link, $this->generateWindowsProxyCode($this->getInstallPath($package).'/'.$bin)); + file_put_contents($link, $this->generateWindowsProxyCode($bin, $link)); } else { - symlink($this->getInstallPath($package).'/'.$bin, $link); + symlink($bin, $link); } chmod($link, 0777); } @@ -168,9 +170,8 @@ class LibraryInstaller implements InstallerInterface } } - private function generateWindowsProxyCode($bin) + private function generateWindowsProxyCode($bin, $link) { - $link = $this->binDir.'/'.basename($bin); $binPath = $this->filesystem->findShortestPath($link, $bin); if ('.bat' === substr($bin, -4)) { $caller = 'call'; @@ -194,9 +195,8 @@ class LibraryInstaller implements InstallerInterface $caller." %BIN_TARGET% %*\r\n"; } - private function generateUnixyProxyCode($bin) + private function generateUnixyProxyCode($bin, $link) { - $link = $this->binDir.'/'.basename($bin); $binPath = $this->filesystem->findShortestPath($link, $bin); return "#!/usr/bin/env sh\n".