From 04e68d0107460575a86cc427338eae436be16286 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 12 Mar 2010 15:11:10 +0000 Subject: * ruby.c (ruby_init_loadpath_safe): mark initial load paths. * gem_prelude.rb (push_all_highest_version_gems_on_load_path): search insertion position by initial load path mark. * lib/rubygems.rb (Gem.load_path_insert_index): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index fdca44593d..bf0f83d67c 100644 --- a/ruby.c +++ b/ruby.c @@ -339,6 +339,7 @@ void ruby_init_loadpath_safe(int safe_level) { VALUE load_path; + ID id_initial_load_path_mark; extern const char ruby_initial_load_paths[]; const char *paths = ruby_initial_load_paths; #if defined LOAD_RELATIVE @@ -432,16 +433,18 @@ ruby_init_loadpath_safe(int safe_level) #define RUBY_RELATIVE(path, len) rubylib_mangled_path(path, len) #define PREFIX_PATH() rubylib_mangled_path(RUBY_LIB_PREFIX, sizeof(RUBY_LIB_PREFIX)-1) #endif -#define incpush(path) rb_ary_push(load_path, (path)) load_path = GET_VM()->load_path; if (safe_level == 0) { ruby_push_include(getenv("RUBYLIB"), identical_path); } + id_initial_load_path_mark = rb_intern_const("@gem_prelude_index"); while (*paths) { size_t len = strlen(paths); - incpush(RUBY_RELATIVE(paths, len)); + VALUE path = RUBY_RELATIVE(paths, len); + rb_ivar_set(path, id_initial_load_path_mark, path); + rb_ary_push(load_path, path); paths += len + 1; } -- cgit v1.2.3