ancestors method

Iterable<WindowsPath> ancestors()

Produces an iterator over Path and its ancestors. e.g. /a/b/c will produce /a/b/c, /a/b, /a, and /.

Implementation

Iterable<WindowsPath> ancestors() sync* {
  yield this;
  WindowsPath? current = parent().v;
  while (current != null) {
    yield current;
    current = current.parent().v;
  }
}