Add basic file-system functionality

std.fs.list_dir will list the files in a directory, std.fs.file_is_dir
will, given a pathname, determine whether it is a directory or not.
This commit is contained in:
Marijn Haverbeke
2011-03-10 15:56:51 +01:00
committed by Graydon Hoare
parent 3436979b17
commit c731d625fe
15 changed files with 146 additions and 61 deletions

View File

@@ -86,6 +86,7 @@ tag fileflag {
append;
create;
truncate;
none;
}
state obj fd_buf_writer(int fd, bool must_close) {
@@ -120,6 +121,7 @@ fn file_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
case (append) { fflags |= os.libc_constants.O_APPEND(); }
case (create) { fflags |= os.libc_constants.O_CREAT(); }
case (truncate) { fflags |= os.libc_constants.O_TRUNC(); }
case (none) {}
}
}