/**
  * Initialize system dirs
  *
  * @return $this
  */
 protected function initDirs()
 {
     $config = Tools::getConfig()->offsetGet('application');
     $dirs = array('modelsDir', 'controllersDir', 'migrationsDir');
     $this->path->setRootPath(dirname(getcwd()));
     $projectPath = $this->path->getRootPAth();
     foreach ($dirs as $dirName) {
         if (isset($config[$dirName]) && $config[$dirName]) {
             if ($this->isAbsolutePath($config[$dirName])) {
                 $path = $config[$dirName];
             } else {
                 $path = $projectPath . $config[$dirName];
             }
             $path = rtrim($path, '\\/') . DIRECTORY_SEPARATOR;
             if (file_exists($path)) {
                 $this->{$dirName} = $path;
             }
         }
     }
     return $this;
 }
Example #2
0
 /**
  * Check if a path is absolute
  *
  * @param string $path Path to check
  *
  * @return bool
  */
 public function isAbsolutePath($path)
 {
     return $this->path->isAbsolutePath($path);
 }