Skip to content

Commit 671adeb

Browse files
committed
refactor: move chdir() up
1 parent f089613 commit 671adeb

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

public/index.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// Path to the front controller (this file)
44
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
55

6+
// Ensure the current directory is pointing to the front controller's directory
7+
chdir(FCPATH);
8+
69
/*
710
*---------------------------------------------------------------
811
* BOOTSTRAP THE APPLICATION
@@ -12,9 +15,6 @@
1215
* and fires up an environment-specific bootstrapping.
1316
*/
1417

15-
// Ensure the current directory is pointing to the front controller's directory
16-
chdir(FCPATH);
17-
1818
// Load our paths config file
1919
// This is the line that might need to be changed, depending on your folder structure.
2020
require FCPATH . '../app/Config/Paths.php';
@@ -38,6 +38,7 @@
3838
* the application run, and does all of the dirty work to get
3939
* the pieces all working together.
4040
*/
41+
4142
$app = Config\Services::codeigniter();
4243
$app->initialize();
4344
$context = is_cli() ? 'php-cli' : 'web';
@@ -50,4 +51,5 @@
5051
* Now that everything is setup, it's time to actually fire
5152
* up the engines and make this app do its thang.
5253
*/
54+
5355
$app->run();

spark

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ define('SPARKED', true);
4040
// Path to the front controller
4141
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
4242

43+
// Ensure the current directory is pointing to the front controller's directory
44+
chdir(FCPATH);
45+
4346
/*
4447
*---------------------------------------------------------------
4548
* BOOTSTRAP THE APPLICATION
@@ -49,9 +52,6 @@ define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR)
4952
* and fires up an environment-specific bootstrapping.
5053
*/
5154

52-
// Ensure the current directory is pointing to the front controller's directory
53-
chdir(FCPATH);
54-
5555
// Load our paths config file
5656
// This is the line that might need to be changed, depending on your folder structure.
5757
require FCPATH . '../app/Config/Paths.php';
@@ -66,6 +66,7 @@ require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstra
6666
require_once SYSTEMPATH . 'Config/DotEnv.php';
6767
(new CodeIgniter\Config\DotEnv(ROOTPATH))->load();
6868

69+
// Grab our CodeIgniter
6970
$app = Config\Services::codeigniter();
7071
$app->initialize();
7172
$app->setContext('spark');

system/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
* GRAB OUR CONSTANTS & COMMON
6767
* ---------------------------------------------------------------
6868
*/
69+
6970
if (! defined('APP_NAMESPACE')) {
7071
require_once APPPATH . 'Config/Constants.php';
7172
}

0 commit comments

Comments
 (0)