diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-12 02:00:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-12 02:00:55 +0000 |
commit | d7f67b4970975c9fdd06d7fe9426468c2e3fef2c (patch) | |
tree | 672e2c981e1bf5131eec6f6ff164fa6557955f37 | |
parent | 1eeeb00a0a9e3316e7ac881d5201e6601335dc12 (diff) | |
download | ruby-d7f67b4970975c9fdd06d7fe9426468c2e3fef2c.tar.gz |
* load.c (rb_feature_p): load path must be expanded.
[ruby-dev:37388]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | load.c | 19 |
2 files changed, 29 insertions, 1 deletions
@@ -1,3 +1,14 @@ +Fri Dec 12 11:00:52 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * load.c (rb_feature_p): load path must be expanded. + [ruby-dev:37388] + +Fri Dec 12 10:28:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * configure.in (rb_version): greps only the line that defines version. + + * version.h (RUBY_VERSION_CODE, RUBY_RELEASE_CODE): removed. + Fri Dec 12 10:20:55 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * complex.c, rational.c: do not use RUBY_VERSION_CODE. @@ -33,6 +33,22 @@ rb_get_load_path(void) 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 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c 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)) { |