Permalink
Browse files

Suggest current path in bake project if dir is empty

  • Loading branch information...
1 parent 8da42df commit 0e34bd4b1d4acc0da89082546aeecdbb55aca7d3 Jelle Henkens committed Jun 2, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/Cake/Console/Command/Task/ProjectTask.php
@@ -47,11 +47,18 @@ public function execute() {
$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'])) {

0 comments on commit 0e34bd4

Please sign in to comment.