rootPrefix function

String rootPrefix (String path)

Returns the root of path, if it's absolute, or the empty string if it's relative.

// Unix
p.rootPrefix('path/to/foo'); // -> ''
p.rootPrefix('/path/to/foo'); // -> '/'

// Windows
p.rootPrefix(r'path\to\foo'); // -> ''
p.rootPrefix(r'C:\path\to\foo'); // -> r'C:\'

// URL
p.rootPrefix('path/to/foo'); // -> ''
p.rootPrefix('http://dartlang.org/path/to/foo');
  // -> 'http://dartlang.org'

Implementation

String rootPrefix(String path) => context.rootPrefix(path);