+ # Return the canonicalized absolute pathname (see POSIX function `realpath`)
+ fun realpath: String do
+ var cs = to_cstring.file_realpath
+ var res = cs.to_s_with_copy
+ # cs.free_malloc # FIXME memory leak
+ return res
+ end
+
+ # Simplify a file path by remove useless ".", removing "//", and resolving ".."
+ # ".." are not resolved if they start the path
+ # starting "/" is not removed
+ # trainling "/" is removed
+ #
+ # Note that the method only wonrk on the string:
+ # * no I/O access is performed
+ # * the validity of the path is not checked
+ #
+ # assert "some/./complex/../../path/from/../to/a////file//".simplify_path == "path/to/a/file"
+ # assert "../dir/file".simplify_path == "../dir/file"
+ # assert "dir/../../".simplify_path == ".."
+ # assert "dir/..".simplify_path == "."
+ # assert "//absolute//path/".simplify_path == "/absolute/path"
+ fun simplify_path: String