Merge the update suggested by @mattn; ref #4950

parent 30eaee30
...@@ -283,8 +283,10 @@ static int ...@@ -283,8 +283,10 @@ static int
mrb_file_is_absolute_path(const char *path) mrb_file_is_absolute_path(const char *path)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (strlen(path) < 2) return 0; #define IS_PATHSEP(x) (x == '/' || x == '\')
return path[0] >= 64 && path[0] <= 90 && path[1] == ':'; // 64 to 90 is ASCII if (strlen(path) < 3) return 0;
return (isalpha(path[0]) && path[1] == ':' && IS_PATHSEP(path[2]));
#undef IS_PATHSEP
#else #else
return (path[0] == '/'); return (path[0] == '/');
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment