parent property

FilePath parent

Returns the containing Path. Returns a non-null value even if this is a root directory.

See FileSystemEntity.parent.

Implementation

FilePath get parent {
  int index = _path.lastIndexOf(_sep);

  // Do string manipulation if there are path separators; otherwise, use the
  // file system entity information.
  if (index == 0 || index == -1) {
    FileSystemEntity e = entity;
    return e == null ? null : new FilePath(e.parent);
  } else {
    return new FilePath(_path.substring(0, index));
  }
}