Browse Source

Fix paths and include composer autoload if it exists.

mark_story 13 years ago
parent
commit
cecf4cfd75
2 changed files with 12 additions and 11 deletions
  1. 4 0
      App/Config/bootstrap.php
  2. 8 11
      App/Config/paths.php

+ 4 - 0
App/Config/bootstrap.php

@@ -14,6 +14,10 @@
  */
 namespace App\Config;
 
+if (file_exists(dirname(__DIR__) . 'vendor/autoload.php')) {
+	require dirname(__DIR__) . 'vendor/autoload.php';
+}
+
 /**
  * Configure paths required to find CakePHP + general filepath
  * constants

+ 8 - 11
App/Config/paths.php

@@ -102,20 +102,17 @@ define('JS_URL', 'js/');
 /**
  * The absolute path to the "cake" directory, WITHOUT a trailing DS.
  *
- * Un-comment this line to specify a fixed path to CakePHP.
- * This should point at the directory containing `Cake`.
- *
- * For ease of development CakePHP uses PHP's include_path.  If you
- * cannot modify your include_path set this value.
- *
- * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
+ * Attempt to use composer's vendor directories. If that fails,
+ * assume the standard lib/Cake path.
  */
-//TODO include_path support.
-define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
-
-define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
+if (file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
+	define('CAKE_CORE_INCLUDE_PATH', dirname(__DIR__) . '/vendor/cakephp/framework');
+} else {
+	define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+}
 
 /**
  * Path to the cake directory.
  */
+define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
 define('CAKE', CORE_PATH . 'Cake' . DS);