mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Suggest current path in bake project if dir is empty
This commit is contained in:
parent
8da42dfcfa
commit
0e34bd4b1d
1 changed files with 8 additions and 1 deletions
|
@ -47,11 +47,18 @@ class ProjectTask extends AppShell {
|
||||||
$project = null;
|
$project = null;
|
||||||
if (isset($this->args[0])) {
|
if (isset($this->args[0])) {
|
||||||
$project = $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) {
|
while (!$project) {
|
||||||
$prompt = __d('cake_console', "What is the path to the project you want to bake?");
|
$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'])) {
|
if ($project && !Folder::isAbsolute($project) && isset($_SERVER['PWD'])) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue