diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1107,7 +1107,7 @@ rb_file_s_expand_path(argc, argv) } } #endif - else if (s[0] != '/') { + else if (!isdirsep(*s)) { if (argc == 2) { dname = rb_file_s_expand_path(1, &dname); strcpy(buf, RSTRING(dname)->ptr); @@ -1122,6 +1122,13 @@ rb_file_s_expand_path(argc, argv) p = &buf[strlen(buf)]; while (p > buf && *(p - 1) == '/') p--; } + else if (isdirsep(*s)) { + while (*s && isdirsep(*s)) { + *p++ = '/'; + s++; + } + if (p > buf && *s) p--; + } *p = '/'; for ( ; *s; s++) { |