Skip to content

Commit

Permalink
Fix default config directory (relative to current class)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcovtwout committed May 21, 2014
1 parent 6e02036 commit 1144b07
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Environment.php
Expand Up @@ -31,7 +31,7 @@ class Environment
/**
* @var string config dir
*/
protected $configDir = '../../../config/';
protected $configDir;

/**
* @var string path to yii.php
Expand Down Expand Up @@ -88,12 +88,23 @@ protected function getValidModes()
* @param string $configDir override default configDir
*/
public function __construct($mode = null, $configDir = null)
{
$this->setConfigDir($configDir);
$this->setMode($mode);
$this->setEnvironment();
}

/**
* Set config dir.
* @param string $configDir
*/
protected function setConfigDir($configDir)
{
if ($configDir !== null) {
$this->configDir = rtrim($configDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
} else {
$this->configDir = __DIR__ . '/../../../config/';
}
$this->setMode($mode);
$this->setEnvironment();
}

/**
Expand Down

0 comments on commit 1144b07

Please sign in to comment.