From d27989c808764b0ea2336f52f894d40040c780f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haso=C5=88?= Date: Tue, 31 Jan 2012 15:04:49 +0100 Subject: [PATCH] Fixed obscure code --- src/Composer/Autoload/AutoloadGenerator.php | 2 +- tests/Composer/Test/Autoload/AutoloadGeneratorTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 47e75a944..78eb09f2f 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -54,7 +54,7 @@ EOF; $filesystem = new Filesystem(); $vendorPath = strtr(realpath($installationManager->getVendorPath()), '\\', '/'); - $relVendorPath = ltrim(substr($vendorPath, strlen(getcwd())), '/'); + $relVendorPath = $filesystem->findShortestPath(getcwd(), $vendorPath); $vendorDirCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true); $namespacesFile = <<assertAutoloadFiles('main', $this->vendorDir.'/.composer'); } + public function testVendorDirSameAsWorkingDir() + { + chdir($this->vendorDir); + $this->testMainPackageAutoloading(); + } + public function testMainPackageAutoloadingAlternativeVendorDir() { $package = new MemoryPackage('a', '1.0', '1.0');