Skip to content

Commit

Permalink
Merge pull request #591 from ApiGen/4.1
Browse files Browse the repository at this point in the history
ThemeConfigPathResolver: fixed for vendor [closes #590]
  • Loading branch information
Tomáš Votruba committed Apr 9, 2015
2 parents 414fd83 + e9aff53 commit dbbc495
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Theme/ThemeConfigPathResolver.php
Expand Up @@ -36,12 +36,19 @@ public function __construct($rootDir)
*/
public function resolve($path)
{
$absolutePath = $this->rootDir . '/' . ltrim($path, DIRECTORY_SEPARATOR);
if (file_exists($absolutePath)) {
return $absolutePath;
$allowedPaths = [
$this->rootDir,
$this->rootDir . '/../../..'
];

foreach ($allowedPaths as $allowedPath) {
$absolutePath = $allowedPath . '/' . ltrim($path, DIRECTORY_SEPARATOR);
if (file_exists($absolutePath)) {
return $absolutePath;
}
}

throw new ConfigurationException('Config "' . $path . "' was not found in '" . $absolutePath . "'");
throw new ConfigurationException(sprintf('Config "%s" was not found.', $path));
}

}

0 comments on commit dbbc495

Please sign in to comment.