var path = "/foo/bar/baz".to_path
assert path.dir.to_s == "/foo/bar"
assert path.dir.dir.to_s == "/foo"
assert path.dir.dir.dir.to_s == "/"
See String:dirname
for details.
The result does not depend of the file system, thus is cached for efficiency.
# Return the directory part of the path.
#
# ~~~
# var path = "/foo/bar/baz".to_path
# assert path.dir.to_s == "/foo/bar"
# assert path.dir.dir.to_s == "/foo"
# assert path.dir.dir.dir.to_s == "/"
# ~~~
#
# See `String:dirname` for details.
#
# The result does not depend of the file system, thus is cached for efficiency.
var dir: Path is lazy do
return path.dirname.to_path
end
lib/core/file.nit:415,2--429,4