diff --git a/app/Stimpack/Manipulator.php b/app/Stimpack/Manipulator.php index 7e18e12..fc3a0d0 100644 --- a/app/Stimpack/Manipulator.php +++ b/app/Stimpack/Manipulator.php @@ -84,4 +84,14 @@ public static function projects() { chdir(public_path()); return $projects; } + + protected function env($key, $defaultAlsoAppliesIfEmpty) + { + $value = env($key, ""); + if($value == "") { + return $defaultAlsoAppliesIfEmpty; + } + + return $value; + } } \ No newline at end of file diff --git a/app/Stimpack/Manipulators/Create.php b/app/Stimpack/Manipulators/Create.php index fad7cd9..c54fa11 100644 --- a/app/Stimpack/Manipulators/Create.php +++ b/app/Stimpack/Manipulators/Create.php @@ -17,8 +17,7 @@ public function perform() { $zip = new ZipArchive; $res = $zip->open(storage_path("stimpack/laravel.zip")); if ($res === TRUE) { - return env('STIMPACK_CODE_PATH') . "/" . $this->data->path; - $zip->extractTo(env('STIMPACK_CODE_PATH', '/home/anders/Code') . "/" . $this->data->path); + $zip->extractTo($this->env('STIMPACK_CODE_PATH', base_path("../")) . $this->data->path); $zip->close(); } else { return "some Error?";