Fix: Check for null install directory earlier
Allows for failing fast when no install directory was provided to the command(uses package name instead).pull/8412/head
parent
e5e8736383
commit
11207a9a2e
|
@ -279,6 +279,12 @@ EOT
|
||||||
$packageVersion = $requirements[0]['version'];
|
$packageVersion = $requirements[0]['version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if no directory was specified, use the 2nd part of the package name
|
||||||
|
if (null === $directory) {
|
||||||
|
$parts = explode("/", $name, 2);
|
||||||
|
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
||||||
|
}
|
||||||
|
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
if (is_dir($directory) && !$fs->isDirEmpty($directory)) {
|
if (is_dir($directory) && !$fs->isDirEmpty($directory)) {
|
||||||
throw new \InvalidArgumentException("Project directory $directory is not empty.");
|
throw new \InvalidArgumentException("Project directory $directory is not empty.");
|
||||||
|
@ -325,11 +331,6 @@ EOT
|
||||||
throw new \InvalidArgumentException($errorMessage .'.');
|
throw new \InvalidArgumentException($errorMessage .'.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $directory) {
|
|
||||||
$parts = explode("/", $name, 2);
|
|
||||||
$directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
|
|
||||||
}
|
|
||||||
|
|
||||||
// handler Ctrl+C for unix-like systems
|
// handler Ctrl+C for unix-like systems
|
||||||
if (function_exists('pcntl_async_signals')) {
|
if (function_exists('pcntl_async_signals')) {
|
||||||
@mkdir($directory, 0777, true);
|
@mkdir($directory, 0777, true);
|
||||||
|
|
Loading…
Reference in New Issue