ruby-changes:9169
From: yugui <ko1@a...>
Date: Sat, 13 Dec 2008 10:59:12 +0900 (JST)
Subject: [ruby-changes:9169] Ruby:r20706 (ruby_1_9_1): merges r20655 from trunk into ruby_1_9_1.
yugui 2008-12-13 10:58:51 +0900 (Sat, 13 Dec 2008) New Revision: 20706 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20706 Log: merges r20655 from trunk into ruby_1_9_1. * load.c (rb_feature_p): load path must be expanded. [ruby-dev:37388] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/load.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20705) +++ ruby_1_9_1/ChangeLog (revision 20706) @@ -1,3 +1,8 @@ +Fri Dec 12 11:00:52 2008 Nobuyoshi Nakada <nobu@r...> + + * load.c (rb_feature_p): load path must be expanded. + [ruby-dev:37388] + Fri Dec 12 10:19:21 2008 Nobuyoshi Nakada <nobu@r...> * string.c (rb_string_value_ptr, rb_to_id): do not use a side Index: ruby_1_9_1/load.c =================================================================== --- ruby_1_9_1/load.c (revision 20705) +++ ruby_1_9_1/load.c (revision 20706) @@ -33,6 +33,22 @@ return load_path; } +VALUE +rb_get_expanded_load_path(void) +{ + VALUE load_path = rb_get_load_path(); + VALUE ary = rb_ary_new2(RARRAY_LEN(load_path)); + long i; + + 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); + rb_ary_push(ary, path); + } + rb_obj_freeze(ary); + return ary; +} + static VALUE load_path_getter(ID id, rb_vm_t *vm) { @@ -128,9 +144,10 @@ if ((n = RSTRING_LEN(v)) < len) continue; if (strncmp(f, feature, len) != 0) { if (expanded) continue; - if (!load_path) load_path = rb_get_load_path(); + if (!load_path) load_path = rb_get_expanded_load_path(); if (!(p = loaded_feature_path(f, n, feature, len, type, load_path))) continue; + expanded = 1; f += RSTRING_LEN(p) + 1; } if (!*(e = f + len)) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/