Skip to content

Commit

Permalink
Rework getting value of APPPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Sep 16, 2024
1 parent 36cadb4 commit 43efb9d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"suggest":
{
"rougin/codeigniter": "Codeigniter 3's Composer-based package.",
"rougin/combustor": "A simple CRUD generator for Codeigniter 3.",
"rougin/combustor": "MVC code generator for Codeigniter 3.",
"rougin/credo": "A Doctrine ORM wrapper for Codeigniter 3.",
"rougin/ignite": "Codeigniter 3 as a Composer-based project.",
"rougin/ignite": "A Composer-based Codeigniter 3 project.",
"rougin/refinery": "Database migrations for Codeigniter 3.",
"rougin/wildfire": "A Query Builder wrapper for Codeigniter 3."
}
Expand Down
28 changes: 13 additions & 15 deletions src/SparkPlug.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ class SparkPlug
*/
protected $globals = array();

/**
* @var string
*/
protected $path = '';

/**
* @var array<string, string>
*/
Expand All @@ -32,30 +27,33 @@ class SparkPlug
/**
* @param array<string, string> $globals
* @param array<string, string> $server
* @param string|null $path
* @param string|null $root
*/
public function __construct(array $globals, array $server, $path = null)
public function __construct(array $globals, array $server, $root = null)
{
$this->globals = & $globals;

$this->path = (string) getcwd();

if ($path)
if (! $root)
{
$this->path = $path;
$root = (string) getcwd();
}

$this->server = $server;

$path = $this->path . '/application/';
$app = ((string) realpath($root)) . '/';

if (is_dir($root . '/application'))
{
$app = $root . '/application/';
}

$this->consts['APPPATH'] = $path;
$this->consts['APPPATH'] = $app;

$this->consts['ENVIRONMENT'] = 'development';

$this->consts['VENDOR'] = $this->path . '/vendor/';
$this->consts['VIEWPATH'] = $app . 'views/';

$this->consts['VIEWPATH'] = $path . 'views/';
$this->consts['VENDOR'] = $root . '/vendor/';
}

/**
Expand Down

0 comments on commit 43efb9d

Please sign in to comment.