update autoloader

This commit is contained in:
Georg Ehrke 2014-06-04 11:34:09 +02:00
parent 56a8010c9f
commit 2c00ab13cf
1 changed files with 5 additions and 6 deletions

View File

@ -89,12 +89,11 @@ class Autoloader {
} elseif (strpos($class, 'OCA\\') === 0) {
list(, $app, $rest) = explode('\\', $class, 3);
$app = strtolower($app);
foreach (\OC::$APPSROOTS as $appDir) {
if (stream_resolve_include_path($appDir['path'] . '/' . $app)) {
$paths[] = $appDir['path'] . '/' . $app . '/' . strtolower(str_replace('\\', '/', $rest) . '.php');
// If not found in the root of the app directory, insert '/lib' after app id and try again.
$paths[] = $appDir['path'] . '/' . $app . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php');
}
$appPath = \OC_App::getAppPath($app);
if (stream_resolve_include_path($appPath)) {
$paths[] = $appPath . '/' . strtolower(str_replace('\\', '/', $rest) . '.php');
// If not found in the root of the app directory, insert '/lib' after app id and try again.
$paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php');
}
} elseif (strpos($class, 'Test_') === 0) {
$paths[] = 'tests/lib/' . strtolower(str_replace('_', '/', substr($class, 5)) . '.php');