1
0
Fork 0
pull/140/head
Jordi Boggiano 2011-12-03 21:20:20 +01:00
parent 9028546c5a
commit f0d8626993
1 changed files with 7 additions and 7 deletions

View File

@ -136,19 +136,21 @@ class LibraryInstaller implements InstallerInterface
foreach ($package->getBinaries() as $bin) { foreach ($package->getBinaries() as $bin) {
$link = $this->binDir.'/'.basename($bin); $link = $this->binDir.'/'.basename($bin);
if (file_exists($link)) { if (file_exists($link)) {
echo 'Skipped installation of '.$bin.' for package '.$package->getName().', name conflicts with an existing file';
continue; continue;
} }
$bin = $this->getInstallPath($package).'/'.$bin;
if (defined('PHP_WINDOWS_VERSION_BUILD')) { if (defined('PHP_WINDOWS_VERSION_BUILD')) {
// add unixy support for cygwin and similar environments // add unixy support for cygwin and similar environments
if ('.bat' !== substr($bin, -4)) { 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); chmod($link, 0777);
$link .= '.bat'; $link .= '.bat';
} }
file_put_contents($link, $this->generateWindowsProxyCode($this->getInstallPath($package).'/'.$bin)); file_put_contents($link, $this->generateWindowsProxyCode($bin, $link));
} else { } else {
symlink($this->getInstallPath($package).'/'.$bin, $link); symlink($bin, $link);
} }
chmod($link, 0777); 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); $binPath = $this->filesystem->findShortestPath($link, $bin);
if ('.bat' === substr($bin, -4)) { if ('.bat' === substr($bin, -4)) {
$caller = 'call'; $caller = 'call';
@ -194,9 +195,8 @@ class LibraryInstaller implements InstallerInterface
$caller." %BIN_TARGET% %*\r\n"; $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); $binPath = $this->filesystem->findShortestPath($link, $bin);
return "#!/usr/bin/env sh\n". return "#!/usr/bin/env sh\n".