Skip to content

Commit

Permalink
+ StartController::$prjdir variable containing absolute path to the…
Browse files Browse the repository at this point in the history
… project root directory
  • Loading branch information
hiqsol committed Feb 23, 2016
1 parent a6f476e commit 8c5ef59
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/controllers/StartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ class StartController extends CommonController
{
const MAIN_CONFIG = '.hidev/config.yml';

/**
* @var string absolute path to the project root directory
*/
public $prjdir;

public static $started = false;

public function actionMake()
{
Yii::setAlias('@prjdir', $this->findDir());
Yii::setAlias('@prjdir', $this->findPrjDir());
$this->takeConfig()->includeConfig(static::MAIN_CONFIG);
$this->requireAll();
$this->includeAll();
Expand Down Expand Up @@ -79,12 +84,13 @@ public function includeAll()
* @throws InvalidParamException when failed to find
* @return string path to the root directory of hidev project
*/
protected function findDir()
protected function findPrjDir()
{
$configDir = '.hidev';
for ($i = 0;$i < 9;++$i) {
if (is_dir($configDir)) {
return getcwd();
$this->prjdir = getcwd();
return $this->prjdir;
}
chdir('..');
}
Expand Down

0 comments on commit 8c5ef59

Please sign in to comment.