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

@@ -15,9 +15,10 @@ native mod libc = "libc.so.6" {
fn ungetc(int c, FILE f);
type dir;
// readdir is a mess; handle via wrapper function in rustrt.
fn opendir(sbuf d) -> dir;
fn closedir(dir d) -> int;
type dirent;
fn readdir(dir d) -> dirent;
fn getenv(sbuf n) -> sbuf;
fn setenv(sbuf n, sbuf v, int overwrite) -> int;
@@ -39,10 +40,6 @@ mod libc_constants {
fn S_IWUSR() -> uint { ret 0x0080u; }
}
fn path_sep() -> str {
ret "/";
}
fn exec_suffix() -> str {
ret "";
}