function drush_cwd

8.0.x drush_cwd()
6.x drush_cwd()
7.x drush_cwd()
3.x drush_cwd()
4.x drush_cwd()
5.x drush_cwd()
master 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/
Command callback. Runs "naked" php scripts.
drush_locate_root in includes/
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/
Like Drupal conf_path, but searching from beneath. Allows proper site uri detection in site sub-directories.
pm_dl_destination in commands/pm/
Return the best destination for a particular download type we can find, given the drupal and site contexts.


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


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;