mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 00:24:03 +00:00
move fs routines to c-stack-stdlib
This commit is contained in:
parent
4880065429
commit
b13e7e0f3d
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user