summaryrefslogtreecommitdiffhomepage
path: root/src/file.c
diff options
context:
space:
mode:
authortakahashim <[email protected]>2015-12-04 13:05:03 +0900
committertakahashim <[email protected]>2015-12-04 15:36:41 +0900
commit0f5b8b66b0918576b3419360080ebfac272a4ed5 (patch)
treec1745f626e963969763c7671f2a1bfd633842137 /src/file.c
parent6c67120ed4d6971f40a307dd8e63e0f6a48fb839 (diff)
downloadmruby-0f5b8b66b0918576b3419360080ebfac272a4ed5.tar.gz
mruby-0f5b8b66b0918576b3419360080ebfac272a4ed5.zip
fix file separator
* File::SEPARATOR should be "/" * File::ALT_SEPARATOR should be "\\" or nil.
Diffstat (limited to 'src/file.c')
-rw-r--r--src/file.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/file.c b/src/file.c
index 9e1afe688..a118cf1f5 100644
--- a/src/file.c
+++ b/src/file.c
@@ -46,12 +46,13 @@
#include <pwd.h>
#endif
+#define FILE_SEPARATOR "/"
+
#if defined(_WIN32) || defined(_WIN64)
#define PATH_SEPARATOR ";"
- #define FILE_SEPARATOR "\\"
+ #define FILE_ALT_SEPARATOR "\\"
#else
#define PATH_SEPARATOR ":"
- #define FILE_SEPARATOR "/"
#endif
#ifndef LOCK_SH
@@ -343,6 +344,11 @@ mrb_init_file(mrb_state *mrb)
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));
mrb_define_const(mrb, cnst, "PATH_SEPARATOR", mrb_str_new_cstr(mrb, PATH_SEPARATOR));
+#if defined(_WIN32) || defined(_WIN64)
+ mrb_define_const(mrb, cnst, "ALT_SEPARATOR", mrb_str_new_cstr(mrb, FILE_ALT_SEPARATOR));
+#else
+ mrb_define_const(mrb, cnst, "ALT_SEPARATOR", mrb_nil_value());
+#endif
mrb_define_const(mrb, cnst, "NULL", mrb_str_new_cstr(mrb, NULL_FILE));
}