Skip to content

Commit

Permalink
Fixes first time invocation of config files.
Browse files Browse the repository at this point in the history
  • Loading branch information
typhonius committed Nov 20, 2020
1 parent 3370841 commit ba11b3b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Commands/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ private function createConfigYaml($location)
$yaml = Yaml::dump($config, 3, 2);

if (!is_dir(dirname($location))) {
mkdir(dirname($location), 700);
mkdir(dirname($location), 0700);
}

if (!is_writable($location) && !@chmod($location, 0644)) {
$this->yell(sprintf('%s is not writeable', ucfirst($location)), 40, 'red');
} elseif (file_put_contents($location, $yaml)) {
if (!is_writable(dirname($location)) && !@chmod(dirname($location), 0700)) {
$this->yell(sprintf('%s is not writeable', dirname($location)), 40, 'red');
} elseif (file_put_contents($location, $yaml) && @chmod($location, 0644)) {
$this->say(sprintf('Configuration file written to %s', $location));
} else {
$this->say('Unable to write configuration file.');
Expand Down

0 comments on commit ba11b3b

Please sign in to comment.