- // Auto-detect our core path
- self::$corePath = str_replace("\\", '/', dirname(__FILE__));
+ // Auto-detect core path (first application-common)
+ foreach (array('core', '.') as $possiblePath) {
+ // Create full path for testing
+ $realPath = realpath($possiblePath);
+
+ // Debug message
+ //* NOISY-DEBUG: */ printf('[%s:%d]: realPath[%s]=%s' . PHP_EOL, __METHOD__, __LINE__, gettype($realPath), $realPath);
+
+ // Is it FALSE?
+ if ($realPath === FALSE) {
+ // Then, not found.
+ continue;
+ } // END - if
+
+ // First create full-qualified file name (FQFN) to inc/config.php
+ $fqfn = sprintf(
+ '%s%sinc%sconfig.php',
+ $realPath,
+ DIRECTORY_SEPARATOR,
+ DIRECTORY_SEPARATOR,
+ $possiblePath
+ );
+
+ // Debug message
+ //* NOISY-DEBUG: */ printf('[%s:%d]: fqfn=%s' . PHP_EOL, __METHOD__, __LINE__, $fqfn);
+
+ // Is it readable?
+ if (is_readable($fqfn)) {
+ // Found one
+ self::$corePath = $realPath;
+
+ // Abort here
+ break;
+ } // END - if
+ } // END - foreach