Skip to content

Commit

Permalink
added variable %rootDir%
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 19, 2024
1 parent 226e2df commit 5f8b942
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.stub.neon
Expand Up @@ -4,6 +4,7 @@ parameters:
wwwDir: absolute path to the directory containing the index.php entry file
tempDir: absolute path to the directory for temporary files
vendorDir: absolute path to the directory where Composer installs libraries
rootDir: absolute path to the root project directory
debugMode: indicates whether the application is in debug mode
productionMode: opposite of debugMode
consoleMode: indicates whether the request came through the command line (CLI)
3 changes: 3 additions & 0 deletions src/Bootstrap/Configurator.php
Expand Up @@ -173,6 +173,9 @@ protected function getDefaultParameters(): array
'appDir' => isset($trace[1]['file']) ? dirname($trace[1]['file']) : null,
'wwwDir' => isset($last['file']) ? dirname($last['file']) : null,
'vendorDir' => $loaderRc ? dirname($loaderRc->getFileName(), 2) : null,
'rootDir' => class_exists(InstalledVersions::class)
? rtrim(Nette\Utils\FileSystem::normalizePath(InstalledVersions::getRootPackage()['install_path']), '\\/')
: null,
'debugMode' => $debugMode,
'productionMode' => !$debugMode,
'consoleMode' => PHP_SAPI === 'cli',
Expand Down
1 change: 1 addition & 0 deletions tests/Bootstrap/Configurator.developmentContainer.phpt
Expand Up @@ -37,6 +37,7 @@ Assert::same([
'appDir' => __DIR__,
'wwwDir' => __DIR__,
'vendorDir' => dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'vendor',
'rootDir' => dirname(__DIR__, 2),
'debugMode' => true,
'productionMode' => false,
'consoleMode' => PHP_SAPI === 'cli',
Expand Down
1 change: 1 addition & 0 deletions tests/Bootstrap/Configurator.minimalContainer.phpt
Expand Up @@ -26,6 +26,7 @@ Assert::same([
'appDir' => __DIR__,
'wwwDir' => __DIR__,
'vendorDir' => dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'vendor',
'rootDir' => dirname(__DIR__, 2),
'debugMode' => false,
'productionMode' => true,
'consoleMode' => PHP_SAPI === 'cli',
Expand Down

0 comments on commit 5f8b942

Please sign in to comment.