1
0
Fork 0

[Autoload] Set $vendorDir et $baseDir in ComposerAutoloaderInitTargetDir::getLoader()

pull/963/head
Victor Berchet 2012-08-06 11:33:17 +02:00
parent 4c82c35dbc
commit d2dc73e361
3 changed files with 8 additions and 2 deletions

View File

@ -137,7 +137,7 @@ EOF;
file_put_contents($targetDir.'/include_paths.php', $includePathFile); file_put_contents($targetDir.'/include_paths.php', $includePathFile);
} }
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix)); file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
file_put_contents($targetDir.'/autoload_real'.$suffix.'.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $suffix)); file_put_contents($targetDir.'/autoload_real'.$suffix.'.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix));
copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
} }
@ -295,7 +295,7 @@ return ComposerAutoloaderInit$suffix::getLoader();
AUTOLOAD; AUTOLOAD;
} }
protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $suffix) protected function getAutoloadRealFile($usePSR0, $useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix)
{ {
// TODO the class ComposerAutoloaderInit should be revert to a closure // TODO the class ComposerAutoloaderInit should be revert to a closure
// when APC has been fixed: // when APC has been fixed:
@ -321,6 +321,8 @@ class ComposerAutoloaderInit$suffix
public static function getLoader() public static function getLoader()
{ {
\$loader = new \\Composer\\Autoload\\ClassLoader(); \$loader = new \\Composer\\Autoload\\ClassLoader();
\$vendorDir = $vendorPathCode;
\$baseDir = $appBaseDirCode;
HEADER; HEADER;

View File

@ -10,6 +10,8 @@ class ComposerAutoloaderInitFilesAutoload
public static function getLoader() public static function getLoader()
{ {
$loader = new \Composer\Autoload\ClassLoader(); $loader = new \Composer\Autoload\ClassLoader();
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {

View File

@ -10,6 +10,8 @@ class ComposerAutoloaderInitTargetDir
public static function getLoader() public static function getLoader()
{ {
$loader = new \Composer\Autoload\ClassLoader(); $loader = new \Composer\Autoload\ClassLoader();
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {