File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ abstract class AbstractKernel implements KernelInterface
3131{
3232 public const CONFIG_FILE_PATH = __DIR__ . '/../emitron.config ' ;
3333 protected static ?string $ configFilePath = null ;
34+ protected static ?string $ routerFilePath = null ;
3435 protected ContainerInterface $ container ;
3536 protected array $ userMiddlewares ;
3637 protected ?DispatchConfigInterface $ dispatchConfig = null ;
@@ -77,6 +78,30 @@ public static function getConfigFilePath(): string
7778 return static ::$ configFilePath ;
7879 }
7980
81+ /**
82+ * Set router path
83+ *
84+ * @param string $path
85+ * @return void
86+ */
87+ public static function setRouterFilePath (string $ path ): void
88+ {
89+ static ::$ routerFilePath = $ path ;
90+ }
91+
92+ /**
93+ * Get router path
94+ *
95+ * @return string
96+ */
97+ public static function getRouterFilePath (): string
98+ {
99+ if (static ::$ routerFilePath === null ) {
100+ return realpath (dirname (self ::getConfigFilePath ()));
101+ }
102+ return static ::$ routerFilePath ;
103+ }
104+
80105 /**
81106 * Get config instance for configure dispatch result
82107 *
Original file line number Diff line number Diff line change @@ -131,7 +131,8 @@ public function loadConfigFile(string $path): void
131131 throw new Exception ('The config file do not return a array ' );
132132 }
133133
134- $ this ->dir = realpath (dirname ($ path ));
134+ //$this->dir = realpath(dirname($path));
135+ $ this ->dir = AbstractKernel::getRouterFilePath ();
135136 $ this ->props = new ConfigProps ($ config );
136137 }
137138}
You can’t perform that action at this time.
0 commit comments