* file.c (file_alt_separator): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
980a954f11
commit
b24c8e4dd6
23
file.c
23
file.c
@ -2495,6 +2495,7 @@ rb_file_s_umask(int argc, VALUE *argv)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef FILE_ALT_SEPARATOR
|
#ifdef FILE_ALT_SEPARATOR
|
||||||
#define isdirsep(x) ((x) == '/' || (x) == FILE_ALT_SEPARATOR)
|
#define isdirsep(x) ((x) == '/' || (x) == FILE_ALT_SEPARATOR)
|
||||||
|
static const char file_alt_separator[] = {FILE_ALT_SEPARATOR, '\0'};
|
||||||
#else
|
#else
|
||||||
#define isdirsep(x) ((x) == '/')
|
#define isdirsep(x) ((x) == '/')
|
||||||
#endif
|
#endif
|
||||||
@ -3174,9 +3175,9 @@ realpath_internal(VALUE basedir, VALUE path, int strict)
|
|||||||
volatile VALUE unresolved_path;
|
volatile VALUE unresolved_path;
|
||||||
VALUE loopcheck;
|
VALUE loopcheck;
|
||||||
volatile VALUE curdir = Qnil;
|
volatile VALUE curdir = Qnil;
|
||||||
|
|
||||||
char *path_names = NULL, *basedir_names = NULL, *curdir_names = NULL;
|
char *path_names = NULL, *basedir_names = NULL, *curdir_names = NULL;
|
||||||
char *ptr;
|
char *ptr, *prefixptr = NULL;
|
||||||
|
|
||||||
rb_secure(2);
|
rb_secure(2);
|
||||||
|
|
||||||
@ -3210,11 +3211,21 @@ realpath_internal(VALUE basedir, VALUE path, int strict)
|
|||||||
resolved = rb_str_new(ptr, curdir_names - ptr);
|
resolved = rb_str_new(ptr, curdir_names - ptr);
|
||||||
|
|
||||||
root_found:
|
root_found:
|
||||||
ptr = chompdirsep(RSTRING_PTR(resolved));
|
prefixptr = RSTRING_PTR(resolved);
|
||||||
if (*ptr) {
|
|
||||||
rb_str_set_len(resolved, ptr - RSTRING_PTR(resolved) + 1);
|
|
||||||
}
|
|
||||||
prefixlen = RSTRING_LEN(resolved);
|
prefixlen = RSTRING_LEN(resolved);
|
||||||
|
ptr = chompdirsep(prefixptr);
|
||||||
|
if (*ptr) {
|
||||||
|
prefixlen = ++ptr - prefixptr;
|
||||||
|
rb_str_set_len(resolved, prefixlen);
|
||||||
|
}
|
||||||
|
#ifdef FILE_ALT_SEPARATOR
|
||||||
|
while (prefixptr < ptr) {
|
||||||
|
if (*prefixptr == FILE_ALT_SEPARATOR) {
|
||||||
|
*prefixptr = '/';
|
||||||
|
}
|
||||||
|
prefixptr = CharNext(prefixptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
loopcheck = rb_hash_new();
|
loopcheck = rb_hash_new();
|
||||||
if (curdir_names)
|
if (curdir_names)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user