Skip to content

Commit

Permalink
update autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehrke committed Jun 4, 2014
1 parent 56a8010 commit 2c00ab1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ public function findClass($class) {
} 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');
Expand Down

0 comments on commit 2c00ab1

Please sign in to comment.