mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Duplicate libruby self path
When LOAD_RELATIVE, as `sopath` is truncated to the prefix path, make the duplicate before it. Also make `rb_libruby_selfpath` frozen and hidden.
This commit is contained in:
parent
591ee9d068
commit
f2423be49d
1 changed files with 7 additions and 1 deletions
8
ruby.c
8
ruby.c
|
@ -629,7 +629,13 @@ ruby_init_loadpath(void)
|
||||||
#if defined(LOAD_RELATIVE) || defined(__MACH__)
|
#if defined(LOAD_RELATIVE) || defined(__MACH__)
|
||||||
VALUE libruby_path = runtime_libruby_path();
|
VALUE libruby_path = runtime_libruby_path();
|
||||||
# if defined(__MACH__)
|
# if defined(__MACH__)
|
||||||
rb_libruby_selfpath = libruby_path;
|
VALUE selfpath = libruby_path;
|
||||||
|
# if defined(LOAD_RELATIVE)
|
||||||
|
selfpath = rb_str_dup(selfpath);
|
||||||
|
# endif
|
||||||
|
rb_obj_hide(selfpath);
|
||||||
|
OBJ_FREEZE_RAW(selfpath);
|
||||||
|
rb_libruby_selfpath = selfpath;
|
||||||
rb_gc_register_address(&rb_libruby_selfpath);
|
rb_gc_register_address(&rb_libruby_selfpath);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue