Permalink
Browse files

Making ProjectTask bake constants with DS instead of hardcoded / or \.

Makes developing/deploying to mixed systems easier.

refs #278

Signed-off-by: Mark Story <mark@mark-story.com>
  • Loading branch information...
1 parent d251a1d commit c810b3cde4097a5077c01f983959c68d10fac3d3 @ceeram ceeram committed with markstory Nov 9, 2009
Showing with 2 additions and 2 deletions.
  1. +2 −2 cake/console/libs/tasks/project.php
@@ -224,7 +224,7 @@ function corePath($path) {
$File =& new File($path . 'webroot' . DS . 'index.php');
$contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
- $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents);
+ $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents);
if (!$File->write($result)) {
return false;
}
@@ -235,7 +235,7 @@ function corePath($path) {
$File =& new File($path . 'webroot' . DS . 'test.php');
$contents = $File->read();
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
- $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '" . CAKE_CORE_INCLUDE_PATH . "');", $contents);
+ $result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', ". (strpos(CAKE_CORE_INCLUDE_PATH, '/')===0? " DS . '":"'") . str_replace('/', '\' . DS . \'', trim(CAKE_CORE_INCLUDE_PATH, '/')) . "');", $contents);
if (!$File->write($result)) {
return false;
}

0 comments on commit c810b3c

Please sign in to comment.