From f319c5fb2641b4cb38ca81f136e808db612aaa6f Mon Sep 17 00:00:00 2001 From: Reckordp Date: Sat, 7 Mar 2020 15:18:48 +0700 Subject: Fix typo --- mrbgems/mruby-io/src/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c index b94649534..c8f13b313 100644 --- a/mrbgems/mruby-io/src/file.c +++ b/mrbgems/mruby-io/src/file.c @@ -283,7 +283,7 @@ static int mrb_file_is_absolute_path(const char *path) { #ifdef _WIN32 -#define IS_PATHSEP(x) (x == '/' || x == '\') +#define IS_PATHSEP(x) (x == '/' || x == '\\') if (strlen(path) < 3) return 0; return (isalpha(path[0]) && path[1] == ':' && IS_PATHSEP(path[2])); #undef IS_PATHSEP -- cgit v1.2.3 From 5a4b9fd8772a7bd34c8866716a7622237fed5e7b Mon Sep 17 00:00:00 2001 From: Reckordp Date: Sat, 7 Mar 2020 15:50:14 +0700 Subject: Add absolute path for UNC --- mrbgems/mruby-io/src/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mrbgems/mruby-io/src/file.c b/mrbgems/mruby-io/src/file.c index c8f13b313..ffce0ddcb 100644 --- a/mrbgems/mruby-io/src/file.c +++ b/mrbgems/mruby-io/src/file.c @@ -284,8 +284,10 @@ 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])); + 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] == '/'); -- cgit v1.2.3