function drush_cwd

8.0.x environment.inc drush_cwd()
6.x environment.inc drush_cwd()
7.x environment.inc drush_cwd()
3.x environment.inc drush_cwd()
4.x environment.inc drush_cwd()
5.x environment.inc drush_cwd()
master environment.inc drush_cwd()

Returns the current working directory.

TODO: Could cache result, but it isn't really expensive.

4 calls to drush_cwd()
drush_core_php_script in commands/core/core.drush.inc
Command callback. Runs "naked" php scripts.
drush_locate_root in includes/environment.inc
Exhaustive depth-first search to try and locate the Drupal root directory. This makes it possible to run drush from a subdirectory of the drupal root.
drush_site_path in includes/environment.inc
Like Drupal conf_path, but searching from beneath. Allows proper site uri detection in site sub-directories.
pm_dl_destination in commands/pm/pm.drush.inc
Return the best destination for a particular download type we can find, given the drupal and site contexts.

File

includes/environment.inc, line 775
Functions used by drush to query the environment and setting the current configuration.

Code

function drush_cwd() {
  // We use PWD if available because getcwd() resolves symlinks, which
  // could take us outside of the Drupal root, making it impossible to find.
  // $_SERVER['PWD'] isn't set on windows and generates a Notice.
  $path = isset($_SERVER['PWD']) ? $_SERVER['PWD'] : '';
  if (empty($path)) {
    $path = getcwd();
  }

  // Convert windows paths.
  $path = _drush_convert_path($path);

  return $path;
}