about summary refs log tree commit diff
path: root/src/rt/rust_builtin.cpp
diff options
context:
space:
mode:
authorElly Jones <elly@leptoquark.net>2011-12-16 17:32:09 -0500
committerElly Jones <elly@leptoquark.net>2011-12-16 17:37:21 -0500
commit89e880d613bc797b3867f91cd7f676c9b4737397 (patch)
tree1bdaa03dc685a13b84ff2954767f771e86bb8f21 /src/rt/rust_builtin.cpp
parentb11268780ed7961c710d6a66665b82a2e5019a08 (diff)
downloadrust-89e880d613bc797b3867f91cd7f676c9b4737397.tar.gz
rust-89e880d613bc797b3867f91cd7f676c9b4737397.zip
std: file_is_dir -> path_is_dir, add path_exists
Diffstat (limited to 'src/rt/rust_builtin.cpp')
-rw-r--r--src/rt/rust_builtin.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index dd5831c2917..28c819879b6 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -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;}