Skip to content

Commit

Permalink
Adding a protection to cake console be executed in driver root (windo…
Browse files Browse the repository at this point in the history
…ws). Fixes #1408.
  • Loading branch information
jrbasso committed Feb 21, 2011
1 parent 0e7f2ef commit 21a9904
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cake/console/cake.bat
Expand Up @@ -26,7 +26,7 @@
SET app=%0
SET lib=%~dp0

php -q "%lib%cake.php" -working "%CD%" %*
php -q "%lib%cake.php" -working "%CD% " %*

echo.

Expand Down
9 changes: 7 additions & 2 deletions cake/console/cake.php
Expand Up @@ -501,6 +501,9 @@ function parseParams($params) {
}
$params = str_replace('\\', '/', $params);

if (isset($params['working'])) {
$params['working'] = trim($params['working']);
}
if (!empty($params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
if (empty($this->params['app']) && $params['working'] != $params['root']) {
$params['root'] = dirname($params['working']);
Expand All @@ -516,8 +519,10 @@ function parseParams($params) {
$params['root'] .= '/' . dirname($params['app']);
}

$params['app'] = basename($params['app']);
$params['working'] = rtrim($params['root'], '/') . '/' . $params['app'];

This comment has been minimized.

Copy link
@Theaxiom

Theaxiom Apr 9, 2011

Contributor

This change broke the -app param in shell, using Ubuntu Server 10.10.

This comment has been minimized.

Copy link
@ADmad

ADmad Apr 10, 2011

Member

Thats already fixed in e277324

This comment has been minimized.

Copy link
@Theaxiom

Theaxiom Apr 10, 2011

Contributor

It's broken, trust me. :)

This comment has been minimized.

Copy link
@jrbasso

jrbasso Apr 10, 2011

Author Member

Theaxiom, it was fixed (comment of ADmad) after the release 1.3.8 (current master version).

This comment has been minimized.

Copy link
@ADmad

ADmad Apr 10, 2011

Member

I suggest you test against the 1.3 branch HEAD and trust the results you get.

$params['working'] = rtrim($params['root'], '/');
if (!$isWin || !preg_match('/^[A-Z]:$/i', $params['app'])) {
$params['working'] .= '/' . $params['app'];
}

if (!empty($matches[0]) || !empty($isWin)) {
$params = str_replace('/', '\\', $params);
Expand Down

0 comments on commit 21a9904

Please sign in to comment.