Only allow relative path

This commit is contained in:
Barry vd. Heuvel
2013-05-30 21:26:02 +02:00
parent 3afc4a3ade
commit cca1b5896e
@@ -93,7 +93,7 @@ class ModelsCommand extends Command {
{ {
return array( return array(
array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', '_ide_helper_models.php'), array('filename', 'F', InputOption::VALUE_OPTIONAL, 'The path to the helper file', '_ide_helper_models.php'),
array('dir', 'D', InputOption::VALUE_OPTIONAL, 'The model dir', app_path().'/models'), array('dir', 'D', InputOption::VALUE_OPTIONAL, 'The model dir','models'),
array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'), array('write', 'W', InputOption::VALUE_NONE, 'Write to Model file'),
); );
} }
@@ -141,13 +141,12 @@ class ModelsCommand extends Command {
protected function loadModels(){ protected function loadModels(){
$dir = $this->dir; $dir = base_path().'/'.$this->dir;
if(!file_exists($dir)){
$dir = base_path().'/'.$dir;
}
$models = array(); $models = array();
foreach(ClassMapGenerator::createMap($dir) as $model=> $path){ if(file_exists($dir)){
$models[] = $model; foreach(ClassMapGenerator::createMap($dir) as $model=> $path){
$models[] = $model;
}
} }
return $models; return $models;
} }