瀏覽代碼

[Installer] Make bin symlinks relative, closes #620

Igor Wiedler 13 年之前
父節點
當前提交
aa4ececa2a
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/Composer/Installer/LibraryInstaller.php

+ 6 - 2
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());
         }