1
0
Fork 0

Fix: Fail when install location is a file

In the event a file has the same name as the intended install directory, fail fast too.
pull/8412/head
polarathene 2019-11-05 20:29:57 +13:00
parent 11207a9a2e
commit 5987114f6c
1 changed files with 6 additions and 2 deletions

View File

@ -286,8 +286,12 @@ EOT
}
$fs = new Filesystem();
if (is_dir($directory) && !$fs->isDirEmpty($directory)) {
throw new \InvalidArgumentException("Project directory $directory is not empty.");
if (file_exists($directory)) {
if (!is_dir($directory)) {
throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
} elseif (!$fs->isDirEmpty($directory)) {
throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
}
}
if (null === $stability) {