Signed-off-by: Jean Privat <jean@pryen.org>
end
end
+ # Change the current working directory
+ #
+ # "/etc".chdir
+ # assert getcwd == "/etc"
+ # "..".chdir
+ # assert getcwd == "/"
+ #
+ # TODO: errno
+ fun chdir do to_cstring.file_chdir
+
# Return right-most extension (without the dot)
fun file_extension : nullable String
do
`}
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"
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_stdin_poll_in(self) file_stdin_poll_in_()
int file_stdin_poll_in_(void);