1
0
Fork 0

Allow create-project to be called in an empty dir that exists, fixes #1135, replaces #1206

pull/1640/merge
Jordi Boggiano 2013-03-02 00:01:01 +01:00
parent f06c0cb580
commit 2a23f8c48b
1 changed files with 4 additions and 2 deletions

View File

@ -58,13 +58,15 @@ class ProjectInstaller implements InstallerInterface
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
$installPath = $this->installPath;
if (file_exists($installPath)) {
if (file_exists($installPath) && (count(glob($installPath.'/*')) || count(glob($installPath.'/.*')) > 2)) {
throw new \InvalidArgumentException("Project directory $installPath already exists.");
}
if (!file_exists(dirname($installPath))) {
throw new \InvalidArgumentException("Project root " . dirname($installPath) . " does not exist.");
}
mkdir($installPath, 0777);
if (!is_dir($installPath)) {
mkdir($installPath, 0777);
}
$this->downloadManager->download($package, $installPath);
}