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

5 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_sitealias_evaluate_path in includes/
Evaluate a path from its shorthand form to a literal path usable by rsync.
_drush_sitealias_get_record in includes/
This is a continuation of drush_sitealias_get_record, above. It is not intended to be called directly.


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[] == '/') {
    return TRUE;
  if (drush_is_windows($os)) {
    return preg_match('@^[a-zA-Z]:[\\\/]@', $path);
  return FALSE;