Skip to content

Commit 5f8b942

Browse files
committed
added variable %rootDir%
1 parent 226e2df commit 5f8b942

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

config.stub.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ parameters:
44
wwwDir: absolute path to the directory containing the index.php entry file
55
tempDir: absolute path to the directory for temporary files
66
vendorDir: absolute path to the directory where Composer installs libraries
7+
rootDir: absolute path to the root project directory
78
debugMode: indicates whether the application is in debug mode
89
productionMode: opposite of debugMode
910
consoleMode: indicates whether the request came through the command line (CLI)

src/Bootstrap/Configurator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ protected function getDefaultParameters(): array
173173
'appDir' => isset($trace[1]['file']) ? dirname($trace[1]['file']) : null,
174174
'wwwDir' => isset($last['file']) ? dirname($last['file']) : null,
175175
'vendorDir' => $loaderRc ? dirname($loaderRc->getFileName(), 2) : null,
176+
'rootDir' => class_exists(InstalledVersions::class)
177+
? rtrim(Nette\Utils\FileSystem::normalizePath(InstalledVersions::getRootPackage()['install_path']), '\\/')
178+
: null,
176179
'debugMode' => $debugMode,
177180
'productionMode' => !$debugMode,
178181
'consoleMode' => PHP_SAPI === 'cli',

tests/Bootstrap/Configurator.developmentContainer.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Assert::same([
3737
'appDir' => __DIR__,
3838
'wwwDir' => __DIR__,
3939
'vendorDir' => dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'vendor',
40+
'rootDir' => dirname(__DIR__, 2),
4041
'debugMode' => true,
4142
'productionMode' => false,
4243
'consoleMode' => PHP_SAPI === 'cli',

tests/Bootstrap/Configurator.minimalContainer.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Assert::same([
2626
'appDir' => __DIR__,
2727
'wwwDir' => __DIR__,
2828
'vendorDir' => dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'vendor',
29+
'rootDir' => dirname(__DIR__, 2),
2930
'debugMode' => false,
3031
'productionMode' => true,
3132
'consoleMode' => PHP_SAPI === 'cli',

0 commit comments

Comments
 (0)