Skip to content

Commit adaaf4c

Browse files
authored
Merge pull request TYPO3#37 from helhum/include-idempotent
2 parents 9e1218d + 62ab491 commit adaaf4c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/IncludeFile.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
use Composer\Composer;
14+
use Composer\Config as ComposerConfig;
1415
use Composer\IO\IOInterface;
1516
use Composer\Util\Filesystem;
1617
use TYPO3\CMS\Composer\Plugin\Core\IncludeFile\TokenInterface;
@@ -61,13 +62,15 @@ public function register()
6162
$this->io->writeError('<info>Register typo3/class-alias-loader file in root package autoload definition</info>', true, IOInterface::VERBOSE);
6263

6364
// Generate and write the file
64-
$includeFile = $this->composer->getConfig()->get('vendor-dir') . self::INCLUDE_FILE;
65+
$config = $this->composer->getConfig();
66+
$includeFile = $config->get('vendor-dir') . self::INCLUDE_FILE;
67+
$relativeIncludeFile = $config->get('vendor-dir', ComposerConfig::RELATIVE_PATHS) . self::INCLUDE_FILE;
6568
file_put_contents($includeFile, $this->getIncludeFileContent(dirname($includeFile)));
6669

6770
// Register the file in the root package
6871
$rootPackage = $this->composer->getPackage();
6972
$autoloadDefinition = $rootPackage->getAutoload();
70-
$autoloadDefinition['files'][] = $includeFile;
73+
$autoloadDefinition['files'][] = $relativeIncludeFile;
7174
$rootPackage->setAutoload($autoloadDefinition);
7275
}
7376

0 commit comments

Comments
 (0)