std: file_is_dir -> path_is_dir, add path_exists
This commit is contained in:
parent
b11268780e
commit
89e880d613
6 changed files with 39 additions and 13 deletions
|
|
@ -319,7 +319,7 @@ rust_list_files(rust_str *path) {
|
|||
}
|
||||
|
||||
extern "C" CDECL int
|
||||
rust_file_is_dir(char *path) {
|
||||
rust_path_is_dir(char *path) {
|
||||
struct stat buf;
|
||||
if (stat(path, &buf)) {
|
||||
return 0;
|
||||
|
|
@ -327,6 +327,15 @@ rust_file_is_dir(char *path) {
|
|||
return S_ISDIR(buf.st_mode);
|
||||
}
|
||||
|
||||
extern "C" CDECL int
|
||||
rust_path_exists(char *path) {
|
||||
struct stat buf;
|
||||
if (stat(path, &buf)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern "C" CDECL FILE* rust_get_stdin() {return stdin;}
|
||||
extern "C" CDECL FILE* rust_get_stdout() {return stdout;}
|
||||
extern "C" CDECL FILE* rust_get_stderr() {return stderr;}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,8 @@ rand_free
|
|||
rand_new
|
||||
rand_next
|
||||
refcount
|
||||
rust_file_is_dir
|
||||
rust_path_is_dir
|
||||
rust_path_exists
|
||||
rust_getcwd
|
||||
rust_get_stdin
|
||||
rust_get_stdout
|
||||
|
|
@ -80,4 +81,4 @@ rust_uv_run
|
|||
rust_uv_unref
|
||||
rust_uv_idle_init
|
||||
rust_uv_idle_start
|
||||
rust_uv_size_of_idle_t
|
||||
rust_uv_size_of_idle_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue