|
@@ -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) {
|