function drush_is_absolute_path

8.0.x filesystem.inc drush_is_absolute_path($path, $os = NULL)
6.x filesystem.inc drush_is_absolute_path($path, $os = NULL)
7.x filesystem.inc drush_is_absolute_path($path, $os = NULL)
5.x filesystem.inc drush_is_absolute_path($path, $os = NULL)
master filesystem.inc drush_is_absolute_path($path, $os = NULL)

Determines whether the provided path is absolute or not on the specified O.S. -- starts with "/" on *nix, or starts with "[A-Z]:\" or "[A-Z]:/" on Windows.

Related topics

7 calls to drush_is_absolute_path()
DrushMakeProject::preprocessLocalFileUrl in commands/make/make.project.inc
Rewrite relative URLs and file:/// URLs
drush_correct_absolute_path_for_exec in includes/filesystem.inc
If we are going to pass a path to exec or proc_open, then we need to fix it up under CYGWIN or MINGW. In both of these environments, PHP works with absolute paths such as "C:\path". CYGWIN expects these to be converted to…
drush_engine_topic_command in includes/engines.inc
Implementation of command hook for docs-output-formats
drush_main in includes/preflight.inc
The main Drush function.
drush_preflight_command_dispatch in includes/preflight.inc
Handle any command preprocessing that may need to be done, including potentially redispatching the command immediately (e.g. for remote commands).

... See full list

File

includes/filesystem.inc, line 25
Filesystem utilities.

Code

function drush_is_absolute_path($path, $os = NULL) {
  // Relative paths will never start with a '/', even on Windows,
  // so it is safe to just call all paths that start with a '/'
  // absolute.  This simplifies things for Windows with CYGWIN / MINGW / CWRSYNC,
  // where absolute paths sometimes start c:\path and sometimes
  // start /cygdrive/c/path.
  if ($path[0] == '/') {
    return TRUE;
  }
  if (drush_is_windows($os)) {
    return preg_match('@^[a-zA-Z]:[\\\/]@', $path);
  }
  return FALSE;
}