Skip to content

Commit

Permalink
For custom composer.json paths the default cwd should be that files d…
Browse files Browse the repository at this point in the history
…irectory, fixes ergebnis/composer-normalize#865, refs #10935
  • Loading branch information
Seldaek committed Jul 17, 2022
1 parent c5ff1e1 commit 93eb19e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Composer/Factory.php
Expand Up @@ -303,6 +303,11 @@ public static function createOutput()
*/
public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true, $disableScripts = false)
{
// if a custom composer.json path is given, we change the default cwd to be that file's directory
if (is_string($localConfig) && is_file($localConfig) && null === $cwd) {
$cwd = dirname($localConfig);
}

$cwd = $cwd ?: (string) getcwd();

// load Composer configuration
Expand Down

0 comments on commit 93eb19e

Please sign in to comment.