function drush_is_absolute_path

8.0.x drush_is_absolute_path($path, $os = NULL)
6.x drush_is_absolute_path($path, $os = NULL)
7.x drush_is_absolute_path($path, $os = NULL)
5.x drush_is_absolute_path($path, $os = NULL)
master 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/
Rewrite relative URLs and file:/// URLs
drush_correct_absolute_path_for_exec in includes/
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/
Implementation of command hook for docs-output-formats
drush_main in includes/
The main Drush function.
drush_preflight_command_dispatch in includes/
Handle any command preprocessing that may need to be done, including potentially redispatching the command immediately (e.g. for remote commands).

... See full list


includes/, line 25
Filesystem utilities.


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;