Skip to content
This repository was archived by the owner on Jul 26, 2024. It is now read-only.

Commit 8853033

Browse files
committed
Fixed script-relative app locator when running as phar
Was previously doubling up on the dirname usage leading the locator to look at the parent dir when running as a phar, likely due to the CLI being previously nested in an app dir. Fixes #9
1 parent df21bb3 commit 8853033

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Services/AppLocator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public static function search(string $directory = ''): string
1313
static::getCliDirectory(),
1414
];
1515

16+
var_dump($directoriesToSearch);
17+
1618
foreach ($directoriesToSearch as $directory) {
1719
if ($directory && static::isProbablyAppDirectory($directory)) {
1820
return $directory;
@@ -36,8 +38,9 @@ public static function require(string $directory = ''): string
3638
protected static function getCliDirectory(): string
3739
{
3840
$scriptDir = dirname(__DIR__);
41+
3942
if (str_starts_with($scriptDir, 'phar://')) {
40-
$scriptDir = dirname(Phar::running(false));
43+
return dirname(Phar::running(false));
4144
}
4245

4346
return dirname($scriptDir);

0 commit comments

Comments
 (0)