diff --git a/composer.json b/composer.json
index 208a89ab3..15b7c363f 100644
--- a/composer.json
+++ b/composer.json
@@ -17,7 +17,7 @@
"drush/drush": "^13@beta",
"oomphinc/composer-installers-extender": "^2.0",
"vlucas/phpdotenv": "^5.1",
- "webflo/drupal-finder": "^1.2"
+ "webflo/drupal-finder": "^1.3"
},
"require-dev": {
"drupal/core-dev": "^11@alpha",
diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php
index 088c2b608..0ccdb8564 100644
--- a/scripts/composer/ScriptHandler.php
+++ b/scripts/composer/ScriptHandler.php
@@ -11,7 +11,7 @@
use Composer\Semver\Comparator;
use Drupal\Core\Site\Settings;
use Drupal\Core\Site\SettingsEditor;
-use DrupalFinder\DrupalFinder;
+use DrupalFinder\DrupalFinderComposerRuntime;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Path;
@@ -19,10 +19,14 @@ class ScriptHandler {
public static function createRequiredFiles(Event $event) {
$fs = new Filesystem();
- $drupalFinder = new DrupalFinder();
- $drupalFinder->locateRoot(getcwd());
+ $drupalFinder = new DrupalFinderComposerRuntime();
$drupalRoot = $drupalFinder->getDrupalRoot();
+ if (is_null($drupalRoot)) {
+ $event->getIO()->writeError('Drupal root could not be detected.');
+ exit(1);
+ }
+
$dirs = [
'modules',
'profiles',
@@ -93,7 +97,7 @@ public static function checkComposerVersion(Event $event) {
$io->writeError('You are running a development version of Composer. If you experience problems, please update Composer to the latest stable version.');
}
elseif (Comparator::lessThan($version, '2.3.6')) {
- $io->writeError('Drupal-project requires Composer version 2.3.6 or higher. Please update your Composer before continuing.');
+ $io->writeError('Drupal-project requires Composer version 2.3.6 or higher. Please update your Composer before continuing.');
exit(1);
}
}