function drush_find_path_to_drush

8.0.x drush_find_path_to_drush($home)

Determine where Drush is located, so that we can add that location to the $PATH

1 call to drush_find_path_to_drush()
drush_init_core_init in commands/core/
Initialize local Drush configuration


commands/core/, line 139
Set up local Drush configuration.


function drush_find_path_to_drush($home) {
  // First test: is Drush inside a vendor directory?
  // Does vendor/bin exist?  If so, use that.  We do
  // not have a good way to locate the 'bin' directory
  // if it has been relocated in the composer.json config
  // section.
  if ($vendor_pos = strpos(DRUSH_BASE_PATH, "/vendor/")) {
    $vendor_dir = substr(DRUSH_BASE_PATH, 0, $vendor_pos + 7);
    $vendor_bin = $vendor_dir . '/bin';
    if (is_dir($vendor_bin)) {
      return $vendor_bin;

  // Fallback is to use the directory that Drush is in.