Skip to content

Commit

Permalink
Use phar file path as fallback
Browse files Browse the repository at this point in the history
If no root dir could be detected, try to use
the current directory of the phar file instead.
  • Loading branch information
cmuench committed Oct 25, 2023
1 parent 47d7f54 commit 7771d81
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/N98/Magento/Application/MagentoDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ public function detect(
/* @var $magentoHelper MagentoHelper */
$magentoHelper = $helperSet->get('magento');

return new DetectionResult($magentoHelper, $folder, $subFolders); // @TODO must be refactored
$result = new DetectionResult($magentoHelper, $folder, $subFolders);
if ($result->isDetected()) {
return $result;
}

// try to detect magento at the location of n98-magerun2.phar
$folder = $this->resolveRootDirOption(dirname($_SERVER['argv'][0]));

return new DetectionResult($magentoHelper, $folder, $subFolders);
}

/**
Expand Down

0 comments on commit 7771d81

Please sign in to comment.