From 7222c111ed38bd0f229244e5a9b7077707ad502e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 22 Jan 2012 22:39:54 +0100 Subject: [PATCH] Make sure multiple autoload files can be used together, fixes #207 --- src/Composer/Autoload/AutoloadGenerator.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 2a377bc51..99263c0bf 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -27,13 +27,16 @@ class AutoloadGenerator { public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir) { - $autoloadFile = file_get_contents(__DIR__.'/ClassLoader.php'); - $autoloadFile .= <<<'EOF' + $autoloadFile = <<<'EOF' +register(); return $loader; -} +}; -return init(); +return $__composer_autoload_init(); EOF; $filesystem = new Filesystem(); @@ -117,6 +120,8 @@ EOF; file_put_contents($targetDir.'/autoload.php', $autoloadFile); file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); + file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); + copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); } /**