end
end
+ # 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
private fun file_mkdir: Bool is extern "string_NativeString_NativeString_file_mkdir_0"
private fun file_delete: Bool is extern "string_NativeString_NativeString_file_delete_0"
private fun file_chdir is extern "string_NativeString_NativeString_file_chdir_0"
+ private fun file_realpath: NativeString is extern "file_NativeString_realpath"
end
extern FileStat `{ struct stat * `}
#define string_NativeString_NativeString_file_mkdir_0(p) (mkdir(p, 0777))
#define string_NativeString_NativeString_file_getcwd_0(p) (getcwd(NULL, 0))
#define string_NativeString_NativeString_file_chdir_0(p) (chdir(p)?-1:0) /* hack to avoid warn_unused_result */
+#define file_NativeString_realpath(p) (realpath(p, NULL))
#define file_stdin_poll_in(self) file_stdin_poll_in_()
int file_stdin_poll_in_(void);