Skip to content

Commit

Permalink
Allow using full path for file
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson committed Jan 3, 2018
1 parent 1f635bb commit 7eede77
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions application/commands/ImportCommand.php
Expand Up @@ -41,10 +41,16 @@ public function actionIndex($file,$userId=null)

}

$surveyFile = __DIR__ . '/../../'.$file;
if($file[0]===DIRECTORY_SEPARATOR){
// we have root path set
$surveyFile = $file;
}else{
$surveyFile = __DIR__ . '/../../'.$file;
}


if (!file_exists($surveyFile)) {
echo 'Fatal error: found no survey file'.PHP_EOL;;
echo sprintf('Fatal error: found no survey file at "%s"',$surveyFile).PHP_EOL;;
exit(1);
}

Expand Down

0 comments on commit 7eede77

Please sign in to comment.