1818use Tempest \EventBus \EventBus ;
1919use Tempest \Process \GenericProcessExecutor ;
2020use Tempest \Router \Exceptions \HttpExceptionHandler ;
21+ use Tempest \Support \Filesystem ;
2122
2223final class FrameworkKernel implements Kernel
2324{
@@ -34,14 +35,20 @@ public function __construct(
3435 /** @var \Tempest\Discovery\DiscoveryLocation[] $discoveryLocations */
3536 public array $ discoveryLocations = [],
3637 ?Container $ container = null ,
38+ ?string $ internalStorage = null ,
3739 ) {
3840 $ this ->container = $ container ?? $ this ->createContainer ();
41+
42+ if ($ internalStorage !== null ) {
43+ $ this ->internalStorage = $ internalStorage ;
44+ }
3945 }
4046
4147 public static function boot (
4248 string $ root ,
4349 array $ discoveryLocations = [],
4450 ?Container $ container = null ,
51+ ?string $ internalStorage = null ,
4552 ): self {
4653 if (! defined ('TEMPEST_START ' )) {
4754 define ('TEMPEST_START ' , value: hrtime (true ));
@@ -51,6 +58,7 @@ public static function boot(
5158 root: $ root ,
5259 discoveryLocations: $ discoveryLocations ,
5360 container: $ container ,
61+ internalStorage: $ internalStorage ,
5462 )
5563 ->validateRoot ()
5664 ->loadEnv ()
@@ -68,7 +76,7 @@ public static function boot(
6876
6977 public function validateRoot (): self
7078 {
71- $ root = realpath ($ this ->root );
79+ $ root = Filesystem \normalize_path ($ this ->root );
7280
7381 if (! is_dir ($ root )) {
7482 throw new RuntimeException ('The specified root directory is not valid. ' );
@@ -175,7 +183,7 @@ public function loadConfig(): self
175183
176184 public function registerInternalStorage (): self
177185 {
178- $ path = $ this ->root . '/.tempest ' ;
186+ $ path = isset ( $ this -> internalStorage ) ? $ this -> internalStorage : $ this ->root . '/.tempest ' ;
179187
180188 if (! is_dir ($ path )) {
181189 if (file_exists ($ path )) {
@@ -189,7 +197,7 @@ public function registerInternalStorage(): self
189197 throw CouldNotRegisterInternalStorage::noPermission ($ path );
190198 }
191199
192- $ this ->internalStorage = realpath ($ path );
200+ $ this ->internalStorage = Filesystem \normalize_path ($ path );
193201
194202 return $ this ;
195203 }
0 commit comments