diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-14 22:33:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-14 22:33:09 +0000 |
commit | b24c8e4dd63b7cfc4b8c83db6552a0ed8301533d (patch) | |
tree | 380bbf11fc210bc727c65ff1ff00a10b590282b5 | |
parent | 980a954f11396afc082875684037505c846d54ab (diff) | |
download | ruby-b24c8e4dd63b7cfc4b8c83db6552a0ed8301533d.tar.gz |
* file.c (file_alt_separator): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | file.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -2495,6 +2495,7 @@ rb_file_s_umask(int argc, VALUE *argv) #endif #ifdef FILE_ALT_SEPARATOR #define isdirsep(x) ((x) == '/' || (x) == FILE_ALT_SEPARATOR) +static const char file_alt_separator[] = {FILE_ALT_SEPARATOR, '\0'}; #else #define isdirsep(x) ((x) == '/') #endif @@ -3174,9 +3175,9 @@ realpath_internal(VALUE basedir, VALUE path, int strict) volatile VALUE unresolved_path; VALUE loopcheck; volatile VALUE curdir = Qnil; - + char *path_names = NULL, *basedir_names = NULL, *curdir_names = NULL; - char *ptr; + char *ptr, *prefixptr = NULL; rb_secure(2); @@ -3210,11 +3211,21 @@ realpath_internal(VALUE basedir, VALUE path, int strict) resolved = rb_str_new(ptr, curdir_names - ptr); root_found: - ptr = chompdirsep(RSTRING_PTR(resolved)); + prefixptr = RSTRING_PTR(resolved); + prefixlen = RSTRING_LEN(resolved); + ptr = chompdirsep(prefixptr); if (*ptr) { - rb_str_set_len(resolved, ptr - RSTRING_PTR(resolved) + 1); + prefixlen = ++ptr - prefixptr; + rb_str_set_len(resolved, prefixlen); } - prefixlen = RSTRING_LEN(resolved); +#ifdef FILE_ALT_SEPARATOR + while (prefixptr < ptr) { + if (*prefixptr == FILE_ALT_SEPARATOR) { + *prefixptr = '/'; + } + prefixptr = CharNext(prefixptr); + } +#endif loopcheck = rb_hash_new(); if (curdir_names) |