Use relative paths on debug error page
This commit is contained in:
parent
9a27e7764a
commit
f2be3a7e5b
3 changed files with 17 additions and 2 deletions
|
@ -37,6 +37,8 @@ class App extends \Slim\App
|
|||
/** @var Container $container */
|
||||
$container = $this->getContainer();
|
||||
|
||||
$container['root_path'] = $this->getRootPath();
|
||||
|
||||
// Config.
|
||||
$container['config'] = ConfigFactory::create($container);
|
||||
|
||||
|
@ -110,4 +112,17 @@ class App extends \Slim\App
|
|||
[$jsonController, 'json']
|
||||
)->setName('json');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
private function getRootPath(): ?string
|
||||
{
|
||||
// realpath() can return false but we prefer using null.
|
||||
if ($rootPath = realpath(__DIR__ . '/../')) {
|
||||
return $rootPath;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue