parentOpt method

Option<Path> parentOpt()

Returns the Path without its final component, if there is one. This means it returns Some("")/"" for relative paths with one component. Returns None/null if the path terminates in a root or prefix, or if it’s the empty string.

Implementation

Option<Path> parentOpt() => Env.isWindows
    ? WindowsPath(_string).parentOpt().map((e) => Path(e._string))
    : UnixPath(_string).parentOpt().map((e) => Path(e._string));