From aa4ececa2a10966ab6e63eafbc200218c2eb3f82 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 27 Apr 2012 16:55:43 +0200 Subject: [PATCH] [Installer] Make bin symlinks relative, closes #620 --- src/Composer/Installer/LibraryInstaller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Composer/Installer/LibraryInstaller.php b/src/Composer/Installer/LibraryInstaller.php index c75ebad95..77c1c13fe 100644 --- a/src/Composer/Installer/LibraryInstaller.php +++ b/src/Composer/Installer/LibraryInstaller.php @@ -168,14 +168,18 @@ class LibraryInstaller implements InstallerInterface } file_put_contents($link, $this->generateWindowsProxyCode($bin, $link)); } else { + $cwd = getcwd(); try { // under linux symlinks are not always supported for example // when using it in smbfs mounted folder - symlink($bin, $link); + $relativeBin = $this->filesystem->findShortestPath($link, $bin); + chdir(dirname($link)); + symlink($relativeBin, $link); } catch (\ErrorException $e) { + var_dump($e->getMessage()); file_put_contents($link, $this->generateUnixyProxyCode($bin, $link)); } - + chdir($cwd); } chmod($link, 0777 & ~umask()); }