Browse Source

Suggest current path in bake project if dir is empty

Jelle Henkens 14 years ago
parent
commit
0e34bd4b1d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lib/Cake/Console/Command/Task/ProjectTask.php

+ 8 - 1
lib/Cake/Console/Command/Task/ProjectTask.php

@@ -47,11 +47,18 @@ class ProjectTask extends AppShell {
 		$project = null;
 		if (isset($this->args[0])) {
 			$project = $this->args[0];
+		} else {
+			$appContents = array_diff(scandir(APP), array('.', '..'));
+			if (empty($appContents)) {
+				$suggestedPath = rtrim(APP, DS);
+			} else {
+				$suggestedPath = APP . 'myapp';
+			}
 		}
 
 		while (!$project) {
 			$prompt = __d('cake_console', "What is the path to the project you want to bake?");
-			$project = $this->in($prompt, null, APP . 'myapp');
+			$project = $this->in($prompt, null, $suggestedPath);
 		}
 
 		if ($project && !Folder::isAbsolute($project) && isset($_SERVER['PWD'])) {