diff --git a/app/Console/cake.php b/app/Console/cake.php index a7e737f29..209d12ad2 100644 --- a/app/Console/cake.php +++ b/app/Console/cake.php @@ -23,13 +23,14 @@ if (!defined('DS')) { $dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php'; if (function_exists('ini_set')) { - $root = dirname(dirname(dirname(__FILE__))); - $appDir = basename(dirname(dirname(__FILE__))); - $install = $root . DS . $appDir . DS . 'Lib' . DS . 'cakephp' . DS . 'lib'; + $root = dirname(__DIR__, 2); + $appDir = basename(dirname(__DIR__)); $composerInstall = $root . DS . $appDir . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib'; if (file_exists($composerInstall . DS . $dispatcher)) { $install = $composerInstall; // prefer compose install + } else { + $install = $root . DS . $appDir . DS . 'Lib' . DS . 'cakephp' . DS . 'lib'; } ini_set('include_path', $install . PATH_SEPARATOR . ini_get('include_path')); diff --git a/app/webroot/index.php b/app/webroot/index.php index 705e228e0..95090e1df 100644 --- a/app/webroot/index.php +++ b/app/webroot/index.php @@ -32,17 +32,15 @@ if (!defined('DS')) { /** * The full path to the directory which holds "app", WITHOUT a trailing DS. - * */ if (!defined('ROOT')) { - define('ROOT', dirname(dirname(dirname(__FILE__)))); + define('ROOT', dirname(__DIR__, 2)); } /** * The actual directory name for the "app". - * */ if (!defined('APP_DIR')) { - define('APP_DIR', basename(dirname(dirname(__FILE__)))); + define('APP_DIR', basename(dirname(__DIR__))); } /** @@ -73,10 +71,10 @@ if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispat * Change at your own risk. */ if (!defined('WEBROOT_DIR')) { - define('WEBROOT_DIR', basename(dirname(__FILE__))); + define('WEBROOT_DIR', basename(__DIR__)); } if (!defined('WWW_ROOT')) { - define('WWW_ROOT', dirname(__FILE__) . DS); + define('WWW_ROOT', __DIR__ . DS); } if (!defined('CAKE_CORE_INCLUDE_PATH')) {