diff options
| -rw-r--r-- | mrbgems/mruby-io/src/file.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c index b94649534..ffce0ddcb 100644 --- a/mrbgems/mruby-io/src/file.c +++ b/mrbgems/mruby-io/src/file.c @@ -283,9 +283,11 @@ static int mrb_file_is_absolute_path(const char *path) { #ifdef _WIN32 -#define IS_PATHSEP(x) (x == '/' || x == '\') - if (strlen(path) < 3) return 0; - return (isalpha(path[0]) && path[1] == ':' && IS_PATHSEP(path[2])); +#define IS_PATHSEP(x) (x == '/' || x == '\\') + if (isalpha(path[0])) + return (strlen(path) > 2 && path[1] == ':' && IS_PATHSEP(path[2])); + else + return (IS_PATHSEP(path[0]) && IS_PATHSEP(path[1])); #undef IS_PATHSEP #else return (path[0] == '/'); |
