diff --git a/src/N98/Magento/Application/MagentoDetector.php b/src/N98/Magento/Application/MagentoDetector.php index 4b924e9c..30c48cb5 100644 --- a/src/N98/Magento/Application/MagentoDetector.php +++ b/src/N98/Magento/Application/MagentoDetector.php @@ -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); } /**