From d9fe7ef4924d0e30a0de4ca7ee9c45638b8ebcb4 Mon Sep 17 00:00:00 2001 From: shugo Date: Sat, 13 Mar 2010 01:34:38 +0000 Subject: * load.c (rb_get_expanded_load_path): does not expand paths if all the items in $: are absolute paths. [ruby-core:28113] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- load.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'load.c') diff --git a/load.c b/load.c index 7551b6b629..5f69fd3d56 100644 --- a/load.c +++ b/load.c @@ -37,9 +37,20 @@ VALUE rb_get_expanded_load_path(void) { VALUE load_path = rb_get_load_path(); - VALUE ary = rb_ary_new2(RARRAY_LEN(load_path)); + VALUE ary; long i; + for (i = 0; i < RARRAY_LEN(load_path); ++i) { + VALUE str = RARRAY_PTR(load_path)[i]; + if (TYPE(str) != T_STRING) + RB_GC_GUARD(str) = rb_get_path(str); + if (!rb_is_absolute_path(RSTRING_PTR(str))) + goto relative_path_found; + } + return load_path; + + relative_path_found: + ary = rb_ary_new2(RARRAY_LEN(load_path)); for (i = 0; i < RARRAY_LEN(load_path); ++i) { VALUE path = rb_file_expand_path(RARRAY_PTR(load_path)[i], Qnil); rb_str_freeze(path); -- cgit v1.2.3