Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes #6467, cake bake on windows drive. thanks burzum

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8257 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information...
commit f53181bc967ef4c9e7c46f3a2eade9e48ae6ad56 1 parent a6f25f5
gwoo authored
Showing with 27 additions and 6 deletions.
  1. +8 −6 cake/console/cake.php
  2. +19 −0 cake/tests/cases/console/cake.test.php
View
14 cake/console/cake.php
@@ -446,13 +446,15 @@ function stderr($string) {
*/
function parseParams($params) {
$this->__parseParams($params);
-
$defaults = array('app' => 'app', 'root' => dirname(dirname(dirname(__FILE__))), 'working' => null, 'webroot' => 'webroot');
-
$params = array_merge($defaults, array_intersect_key($this->params, $defaults));
-
- $isWin = array_filter(array_map('strpos', $params, array('\\')));
-
+ $isWin = false;
+ foreach ($defaults as $default => $value) {
+ if (strpos($params[$default], '\\') !== false) {
+ $isWin = true;
+ break;
+ }
+ }
$params = str_replace('\\', '/', $params);
if (!empty($params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
@@ -464,7 +466,7 @@ function parseParams($params) {
}
}
- if ($params['app'][0] == '/' || preg_match('/([a-zA-Z])(:)/i', $params['app'], $matches)) {
+ if ($params['app'][0] == '/' || preg_match('/([a-z])(:)/i', $params['app'], $matches)) {
$params['root'] = dirname($params['app']);
} elseif (strpos($params['app'], '/')) {
$params['root'] .= '/' . dirname($params['app']);
View
19 cake/tests/cases/console/cake.test.php
@@ -396,6 +396,25 @@ function testParseParams() {
$Dispatcher->params = $Dispatcher->args = array();
$Dispatcher->parseParams($params);
$this->assertEqual($expected, $Dispatcher->params);
+
+
+ $params = array(
+ 'cake.php',
+ '-working',
+ 'D:\www',
+ 'bake',
+ 'my_app',
+ );
+ $expected = array(
+ 'working' => 'D:\www',
+ 'app' => 'www',
+ 'root' => 'D:',
+ 'webroot' => 'webroot'
+ );
+
+ $Dispatcher->params = $Dispatcher->args = array();
+ $Dispatcher->parseParams($params);
+ $this->assertEqual($expected, $Dispatcher->params);
}
/**
* testBuildPaths method
Please sign in to comment.
Something went wrong with that request. Please try again.