fixes #4495. updating cake.php and cake.test.php

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6890 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-05-15 15:40:35 +00:00
parent 52037d15e4
commit 17379fff80
2 changed files with 9 additions and 7 deletions

View file

@ -455,7 +455,7 @@ class ShellDispatcher {
} }
if (!empty($this->params['app'])) { if (!empty($this->params['app'])) {
if($this->params['app']{0} == '/' || preg_match('/([a-z])(:)/i', $this->params['app'])) { if($this->params['app']{0} == '/' || preg_match('/([a-z])(:)/i', $this->params['app'], $matches)) {
$root = dirname($this->params['app']); $root = dirname($this->params['app']);
} }
$app = basename($this->params['app']); $app = basename($this->params['app']);
@ -466,9 +466,11 @@ class ShellDispatcher {
$this->params['webroot'] = 'webroot'; $this->params['webroot'] = 'webroot';
} }
$working = str_replace(DS . DS, DS, $root . DS . $app); $this->params = array_merge($this->params, array('app'=> $app, 'root'=> $root, 'working'=> $root . '/' . $app));
$this->params = array_merge($this->params, array('app'=> $app, 'root'=> $root, 'working'=> $working)); if (!empty($matches[0])) {
$this->params = str_replace('/', "\\", $this->params);
}
} }
/** /**
* Helper for recursively paraing params * Helper for recursively paraing params

View file

@ -245,8 +245,8 @@ class ShellDispatcherTest extends UnitTestCase {
$expected = array( $expected = array(
'app' => 'app', 'app' => 'app',
'webroot' => 'webroot', 'webroot' => 'webroot',
'working' => 'C:/wamp/www/apps/cake/app', 'working' => 'C:\wamp\www\apps\cake\app',
'root' => 'C:/wamp/www/apps/cake' 'root' => 'C:\wamp\www\apps\cake'
); );
$Dispatcher->params = $Dispatcher->args = array(); $Dispatcher->params = $Dispatcher->args = array();
@ -265,8 +265,8 @@ class ShellDispatcherTest extends UnitTestCase {
$expected = array( $expected = array(
'app' => 'app', 'app' => 'app',
'webroot' => 'webroot', 'webroot' => 'webroot',
'working' => 'C:/wamp/www/apps/cake/app', 'working' => 'C:\wamp\www\apps\cake\app',
'root' => 'C:/wamp/www/apps/cake' 'root' => 'C:\wamp\www\apps\cake'
); );
$Dispatcher->params = $Dispatcher->args = array(); $Dispatcher->params = $Dispatcher->args = array();