Skip to content

Commit

Permalink
Removing APP_PATH it is always the same as APP.
Browse files Browse the repository at this point in the history
Fixing a typo in index.php.
  • Loading branch information
markstory committed Aug 4, 2011
1 parent 20e9015 commit 6e2870c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 16 deletions.
6 changes: 0 additions & 6 deletions index.php
Expand Up @@ -37,10 +37,4 @@
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
}

/**
* Set the include path or define app and core path
*/
define('APP_PATH', ROOT . DS . APP_DIR . DS);
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);

require APP_DIR . DS . WEBROOT_DIR . DS . 'index.php';
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/CommandListShell.php
Expand Up @@ -45,7 +45,7 @@ public function main() {
if (empty($this->params['xml'])) {
$this->out(__d('cake_console', "<info>Current Paths:</info>"), 2);
$this->out(" -app: ". APP_DIR);
$this->out(" -working: " . rtrim(APP_PATH, DS));
$this->out(" -working: " . rtrim(APP, DS));
$this->out(" -root: " . rtrim(ROOT, DS));
$this->out(" -core: " . rtrim(CORE_PATH, DS));
$this->out("");
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Command/Task/ProjectTask.php
Expand Up @@ -50,7 +50,7 @@ public function execute() {

while (!$project) {
$prompt = __d('cake_console', "What is the path to the project you want to bake?");
$project = $this->in($prompt, null, APP_PATH . 'myapp');
$project = $this->in($prompt, null, APP . 'myapp');
}

if ($project && !Folder::isAbsolute($project) && isset($_SERVER['PWD'])) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/Shell.php
Expand Up @@ -206,7 +206,7 @@ protected function _welcome() {
$this->out(__d('cake_console', '<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version()));
$this->hr();
$this->out(__d('cake_console', 'App : %s', APP_DIR));
$this->out(__d('cake_console', 'Path: %s', APP_PATH));
$this->out(__d('cake_console', 'Path: %s', APP));
$this->hr();
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Console/ShellDispatcher.php
Expand Up @@ -122,15 +122,15 @@ protected function _initEnvironment() {
private function __bootstrap() {
define('ROOT', $this->params['root']);
define('APP_DIR', $this->params['app']);
define('APP_PATH', $this->params['working'] . DS);
define('WWW_ROOT', APP_PATH . $this->params['webroot'] . DS);
define('APP', $this->params['working'] . DS);
define('WWW_ROOT', APP . $this->params['webroot'] . DS);
if (!is_dir(ROOT . DS . APP_DIR . DS . 'tmp')) {
define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'tmp' . DS);
}
$boot = file_exists(ROOT . DS . APP_DIR . DS . 'Config' . DS . 'bootstrap.php');
require CORE_PATH . 'Cake' . DS . 'bootstrap.php';

if (!file_exists(APP_PATH . 'Config' . DS . 'core.php')) {
if (!file_exists(APP . 'Config' . DS . 'core.php')) {

This comment has been minimized.

Copy link
@gBokiau

gBokiau Dec 29, 2012

I believe this should actually have been (ROOT . DS . APP_DIR . DS . 'Config' . DS . 'core.php') as in preceding lookups for bootstrap and tmp

This comment has been minimized.

Copy link
@markstory

markstory Dec 29, 2012

Author Member

Why? APP is defined as ROOT . DS . APP_DIR . DS.

This comment has been minimized.

Copy link
@gBokiau

gBokiau Dec 29, 2012

APP is actually defined as $this->params['working'] (see line 125), so more error-prone

This comment has been minimized.

Copy link
@shama

shama Dec 29, 2012

Contributor

@gBokiau Look more closely at the diff. This change does nothing but remove a duplicate constant. Also look how $this->params['working'] is generated:

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

This comment has been minimized.

Copy link
@gBokiau

gBokiau Dec 30, 2012

I bumped into this while trying to have the webroot directory on the same level as the app directory, e.g.

ROOT
    APP
    WEBROOT

I figured using the root as working directory and manually defining params['app'] and params['webroot'] would be a solution, even though this could lead to problems further down the road, with APP not being correctly defined.

Not only is this currently impossible, but there is room for two conflicting definitions of the same folder without one taking precedence over the other.

This comment has been minimized.

Copy link
@shama

shama Dec 30, 2012

Contributor

You're missing the point. How is APP_PATH different than APP in this commit?

include_once CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'Templates' . DS . 'skel' . DS . 'Config' . DS . 'core.php';
App::build();
}
Expand Down
4 changes: 0 additions & 4 deletions lib/Cake/bootstrap.php
Expand Up @@ -31,10 +31,6 @@
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
}

if (!defined('APP_PATH')) {
define('APP_PATH', ROOT . DS . APP_DIR . DS);
}

if (!defined('WEBROOT_DIR')) {
define('WEBROOT_DIR', 'webroot');
}
Expand Down

0 comments on commit 6e2870c

Please sign in to comment.