summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-io
diff options
context:
space:
mode:
authorReckordp <[email protected]>2020-03-07 09:09:28 +0700
committerReckordp <[email protected]>2020-03-07 09:09:28 +0700
commit8df49ea95564f12ea627dc021b29694143640d3f (patch)
treead01f9e74d777fc06e2e8ac3dd75d33b810f561c /mrbgems/mruby-io
parentf7abda14370e6341dad180da3d04f8f2f4ff0cf0 (diff)
downloadmruby-8df49ea95564f12ea627dc021b29694143640d3f.tar.gz
mruby-8df49ea95564f12ea627dc021b29694143640d3f.zip
Absolute path for windows
Diffstat (limited to 'mrbgems/mruby-io')
-rw-r--r--mrbgems/mruby-io/src/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c
index 830f305fb..ba1d770e3 100644
--- a/mrbgems/mruby-io/src/file.c
+++ b/mrbgems/mruby-io/src/file.c
@@ -282,7 +282,12 @@ mrb_file__getwd(mrb_state *mrb, mrb_value klass)
static int
mrb_file_is_absolute_path(const char *path)
{
+#ifdef _WIN32
+ if (strlen(path) < 2) return 0;
+ return path[0] >= 64 && path[0] <= 90 && path[1] == ':'; // 64 to 90 is ASCII
+#else
return (path[0] == '/');
+#endif
}
static mrb_value