diff --git a/src/Handler.php b/src/Handler.php index bc9eb8e1756595ad0467d0ae8e85cfb9f557aa31..e422400d50a7f06c84e8f2f6a44b616643ac710c 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -84,17 +84,25 @@ class Handler { $fs = new Filesystem(); $installationManager = $this->composer->getInstallationManager(); - $drupalCorePackage = $this->getDrupalCorePackage(); - if (!$drupalCorePackage) { - // We are called too early, Drupal core is not available yet. - return; + if (isset($options['webroot'])) { + if (!$fs->exists($options['webroot'])) { + return; + } + $webRoot = $options['webroot']; + } + else { + $drupalCorePackage = $this->getDrupalCorePackage(); + if (!$drupalCorePackage) { + // We are called too early, Drupal core is not available yet. + return; + } + $corePath = $installationManager->getInstallPath($drupalCorePackage); + // Directory where Drupal's index.php is located + $webRoot = dirname($corePath); } - $corePath = $installationManager->getInstallPath($drupalCorePackage); // Directory where the root project is being created $projectRoot = getcwd(); - // Directory where Drupal's index.php is located - $webRoot = dirname($corePath); // Directory where this plugin is being installed $pluginRoot = $installationManager->getInstallPath($this->getPackage('lakedrops/docker4drupal'));