mirror of
https://github.com/composer/composer
synced 2025-05-10 09:02:59 +00:00
Avoid errors when invoking composer global config and there is no global composer.json yet, refs #4002
This commit is contained in:
parent
4d8b371908
commit
48d8cc6465
1 changed files with 5 additions and 0 deletions
|
@ -141,6 +141,11 @@ EOT
|
|||
? ($this->config->get('home') . '/config.json')
|
||||
: $input->getOption('file');
|
||||
|
||||
// create global composer.json if this was invoked using `composer global config`
|
||||
if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) {
|
||||
file_put_contents($configFile, "{\n}\n");
|
||||
}
|
||||
|
||||
$this->configFile = new JsonFile($configFile);
|
||||
$this->configSource = new JsonConfigSource($this->configFile);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue