summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mrblib/file_constants.rb2
-rw-r--r--src/file.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/mrblib/file_constants.rb b/mrblib/file_constants.rb
index c2552bf56..a68ee2598 100644
--- a/mrblib/file_constants.rb
+++ b/mrblib/file_constants.rb
@@ -1,7 +1,5 @@
class File
module Constants
- NULL = "/dev/null"
-
RDONLY = 0
WRONLY = 1
RDWR = 2
diff --git a/src/file.c b/src/file.c
index c2419c2cc..b6a3c90c7 100644
--- a/src/file.c
+++ b/src/file.c
@@ -311,4 +311,9 @@ mrb_init_file(mrb_state *mrb)
mrb_define_const(mrb, cnst, "LOCK_UN", mrb_fixnum_value(LOCK_UN));
mrb_define_const(mrb, cnst, "LOCK_NB", mrb_fixnum_value(LOCK_NB));
mrb_define_const(mrb, cnst, "SEPARATOR", mrb_str_new_cstr(mrb, FILE_SEPARATOR));
+#if defined(_WIN32) || defined(_WIN64)
+ mrb_define_const(mrb, cnst, "NULL", mrb_str_new_cstr(mrb, "NUL"));
+#else
+ mrb_define_const(mrb, cnst, "NULL", mrb_str_new_cstr(mrb, "/dev/null"));
+#endif
}