5 * Contains Drupal\Console\Core\Utils\DrupalFinder.
8 namespace Drupal\Console\Core\Utils;
10 use DrupalFinder\DrupalFinder as DrupalFinderBase;
11 use Webmozart\PathUtil\Path;
16 * @package Drupal\Console\Core\Utils
18 class DrupalFinder extends DrupalFinderBase
24 protected $consoleCorePath;
29 protected $consolePath;
34 protected $consoleLanguagePath;
36 public function locateRoot($start_path)
38 $vendorDir = 'vendor';
39 if (parent::locateRoot($start_path)) {
40 $vendorDir = Path::makeRelative(
41 $this->getVendorDir(),
42 $this->getComposerRoot()
45 $this->definePaths($vendorDir);
46 $this->defineConstants($vendorDir);
51 $this->definePaths($vendorDir);
52 $this->defineConstants($vendorDir);
57 protected function definePaths($vendorDir)
59 $this->consoleCorePath = "/{$vendorDir}/drupal/console-core/";
60 $this->consolePath = "/{$vendorDir}/drupal/console/";
61 $this->consoleLanguagePath = "/{$vendorDir}/drupal/console-%s/translations/";
64 protected function defineConstants($vendorDir)
66 if (!defined("DRUPAL_CONSOLE_CORE")) {
68 "DRUPAL_CONSOLE_CORE",
69 "/{$vendorDir}/drupal/console-core/"
72 if (!defined("DRUPAL_CONSOLE")) {
73 define("DRUPAL_CONSOLE", "/{$vendorDir}/drupal/console/");
75 if (!defined("DRUPAL_CONSOLE_LANGUAGE")) {
77 "DRUPAL_CONSOLE_LANGUAGE",
78 "/{$vendorDir}/drupal/console-%s/translations/"
82 if (!defined("DRUPAL_CONSOLE_LIBRARY")) {
84 "DRUPAL_CONSOLE_LIBRARY",
85 "/{$vendorDir}/drupal/%s/console/translations/%s"
93 public function getConsoleCorePath()
95 return $this->consoleCorePath;
101 public function getConsolePath()
103 return $this->consolePath;
109 public function getConsoleLanguagePath()
111 return $this->consoleLanguagePath;
114 public function isValidDrupal() {
115 return ($this->getComposerRoot() && $this->getDrupalRoot());