function drush_preflight_root

8.0.x preflight.inc drush_preflight_root()
7.x preflight.inc drush_preflight_root()
master preflight.inc drush_preflight_root()

If --root is provided, set context.

2 calls to drush_preflight_root()
drush_preflight in includes/preflight.inc
During the initialization of Drush, this is the first step where we load our configuration and commandfiles, and select the site we are going to operate on; however, we take no irreversible actions (e.g. site bootstrapping). This allows commands that…
_drush_preflight_root_uri in includes/preflight.inc

File

includes/preflight.inc, line 237
Preflight, postflight and shutdown code.

Code

function drush_preflight_root() {
  $root = drush_get_option('root');
  if (!isset($root)) {
    $root = drush_locate_root();
  }
  if ($root) {
    $root = realpath($root);
  }
  // @todo This context name should not mention Drupal.
  // @todo Drupal code should use DRUSH_DRUPAL_ROOT instead of this constant.
  drush_set_context('DRUSH_SELECTED_DRUPAL_ROOT', $root);

  // Load the config options from Drupal's /drush and sites/all/drush directories,
  // even prior to bootstrapping the root.
  drush_load_config('drupal');
}