summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-io
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-03-07 14:53:37 +0900
committerGitHub <[email protected]>2020-03-07 14:53:37 +0900
commit30eaee30fa3a8478c23abfc8b3ae11b2cbe7f8aa (patch)
tree4be1d9df9b2760ed3787831765500b2c887125b3 /mrbgems/mruby-io
parent7905431fe98b7f075033657aff15982d7e4613e6 (diff)
parent8df49ea95564f12ea627dc021b29694143640d3f (diff)
downloadmruby-30eaee30fa3a8478c23abfc8b3ae11b2cbe7f8aa.tar.gz
mruby-30eaee30fa3a8478c23abfc8b3ae11b2cbe7f8aa.zip
Merge pull request #4950 from Reckordp/master
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 8cd9cba0d..dafcac533 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