absolute method

String absolute (String part1, [ String part2, String part3, String part4, String part5, String part6, String part7 ])

Creates a new path by appending the given path parts to current. Equivalent to join() with current as the first argument. Example:

var context = new Context(current: '/root');
context.absolute('path', 'to', 'foo'); // -> '/root/path/to/foo'

If current isn't absolute, this won't return an absolute path.

Implementation

String absolute(String part1,
    [String part2,
    String part3,
    String part4,
    String part5,
    String part6,
    String part7]) {
  _validateArgList(
      "absolute", [part1, part2, part3, part4, part5, part6, part7]);

  // If there's a single absolute path, just return it. This is a lot faster
  // for the common case of `p.absolute(path)`.
  if (part2 == null && isAbsolute(part1) && !isRootRelative(part1)) {
    return part1;
  }

  return join(current, part1, part2, part3, part4, part5, part6, part7);
}