mirror of
https://github.com/bitinflow/bunny-cli.git
synced 2026-03-13 05:35:54 +00:00
Fix env path for windows
This commit is contained in:
14
app/helpers.php
Normal file
14
app/helpers.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('bunny_cli_path')) {
|
||||
function bunny_cli_path(): string
|
||||
{
|
||||
if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
|
||||
$result = exec("echo %appdata%");
|
||||
} else {
|
||||
$result = getenv('HOME');
|
||||
}
|
||||
|
||||
return $result . DIRECTORY_SEPARATOR . '.bunny-cli';
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ $app = new LaravelZero\Framework\Application(
|
||||
*/
|
||||
|
||||
if (!file_exists(dirname(__DIR__) . DIRECTORY_SEPARATOR . '.env')) {
|
||||
$app->useEnvironmentPath(getenv('HOME') . DIRECTORY_SEPARATOR . '.bunny-cli');
|
||||
$app->useEnvironmentPath(bunny_cli_path());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"app/helpers.php"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -5,7 +5,7 @@ return [
|
||||
'disks' => [
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => getenv('HOME') . DIRECTORY_SEPARATOR . '.bunny-cli',
|
||||
'root' => bunny_cli_path(),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user