summaryrefslogtreecommitdiffhomepage
path: root/src/file_test.c
diff options
context:
space:
mode:
authorPaolo Bosetti <[email protected]>2013-12-10 14:34:26 +0100
committerPaolo Bosetti <[email protected]>2013-12-10 14:34:26 +0100
commit23afaf02dc146346da823f85cea7a51263d0e2b7 (patch)
treef8eb81a88486f024a1473f37db85eadc964da0d8 /src/file_test.c
parent5a59fd3a5c83395847448db333c9df9d253a158c (diff)
downloadmruby-23afaf02dc146346da823f85cea7a51263d0e2b7.tar.gz
mruby-23afaf02dc146346da823f85cea7a51263d0e2b7.zip
Made compatible with VisualStudio
Diffstat (limited to 'src/file_test.c')
-rw-r--r--src/file_test.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/file_test.c b/src/file_test.c
index 309898a47..792440547 100644
--- a/src/file_test.c
+++ b/src/file_test.c
@@ -10,15 +10,18 @@
#include "mruby/string.h"
#include "error.h"
-#include <sys/file.h>
-#include <libgen.h>
+#if defined(_WIN32) || defined(_WIN64)
+ #define LSTAT stat
+#else
+ #define LSTAT lstat
+ #include <sys/file.h>
+ #include <libgen.h>
+ #include <pwd.h>
+ #include <sys/param.h>
+#endif
#include <limits.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/param.h>
-#ifndef _WIN32
-#include <pwd.h>
-#endif
extern struct mrb_data_type mrb_io_type;
@@ -47,7 +50,7 @@ mrb_stat0(mrb_state *mrb, mrb_value obj, struct stat *st, int do_lstat)
tmp = mrb_funcall(mrb, obj, "is_a?", 1, str_klass);
if (mrb_test(tmp)) {
if (do_lstat) {
- return lstat(mrb_str_to_cstr(mrb, obj), st);
+ return LSTAT(mrb_str_to_cstr(mrb, obj), st);
} else {
return stat(mrb_str_to_cstr(mrb, obj), st);
}