move fs routines to c-stack-stdlib

This commit is contained in:
Niko Matsakis 2011-10-19 21:53:02 -07:00 committed by Brian Anderson
parent 4880065429
commit b13e7e0f3d
4 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
import os::getcwd; import os::getcwd;
import os_fs; import os_fs;
native "rust" mod rustrt { native "c-stack-cdecl" mod rustrt {
fn rust_file_is_dir(path: str::sbuf) -> int; fn rust_file_is_dir(path: str::sbuf) -> int;
} }

View File

@ -1,5 +1,5 @@
native "rust" mod rustrt { native "c-stack-cdecl" mod rustrt {
fn rust_list_files(&&path: str) -> [str]; fn rust_list_files(&&path: str) -> [str];
} }

View File

@ -1,6 +1,6 @@
native "rust" mod rustrt { native "c-stack-cdecl" mod rustrt {
fn rust_list_files(&&path: str) -> [str]; fn rust_list_files(&&path: str) -> [str];
fn rust_file_is_dir(&&path: str) -> int; fn rust_file_is_dir(&&path: str) -> int;
} }

View File

@ -325,12 +325,12 @@ debug_ptrcast(type_desc *from_ty,
} }
extern "C" CDECL rust_vec* extern "C" CDECL rust_vec*
rust_list_files(rust_vec **path) { rust_list_files(rust_str *path) {
rust_task *task = rust_scheduler::get_task(); rust_task *task = rust_scheduler::get_task();
array_list<rust_str*> strings; array_list<rust_str*> strings;
#if defined(__WIN32__) #if defined(__WIN32__)
WIN32_FIND_DATA FindFileData; WIN32_FIND_DATA FindFileData;
HANDLE hFind = FindFirstFile((char*)(*path)->data, &FindFileData); HANDLE hFind = FindFirstFile((char*)path->data, &FindFileData);
if (hFind != INVALID_HANDLE_VALUE) { if (hFind != INVALID_HANDLE_VALUE) {
do { do {
rust_str *str = make_str(task->kernel, FindFileData.cFileName, rust_str *str = make_str(task->kernel, FindFileData.cFileName,
@ -341,7 +341,7 @@ rust_list_files(rust_vec **path) {
FindClose(hFind); FindClose(hFind);
} }
#else #else
DIR *dirp = opendir((char*)(*path)->data); DIR *dirp = opendir((char*)path->data);
if (dirp) { if (dirp) {
struct dirent *dp; struct dirent *dp;
while ((dp = readdir(dirp))) { while ((dp = readdir(dirp))) {