summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-18 03:57:37 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-18 03:57:37 +0000
commit3c5452dba11cc909252eaa97c83f7a31c3a230a6 (patch)
tree6d0a443af69f74daaffb08d6ebca3017d4cc8e6f /load.c
parent2171d75e9bd14409d62fcc5a8acdbb2ec1c23060 (diff)
revert r62797, r62784. [Bug #13863]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/load.c b/load.c
index b8946ac91b..bd0f8b8fdf 100644
--- a/load.c
+++ b/load.c
@@ -95,6 +95,15 @@ rb_construct_expanded_load_path(enum expand_type type, int *has_relative, int *h
rb_ary_replace(vm->load_path_snapshot, vm->load_path);
}
+static VALUE
+load_path_getcwd(void)
+{
+ char *cwd = my_getcwd();
+ VALUE cwd_str = rb_filesystem_str_new_cstr(cwd);
+ xfree(cwd);
+ return cwd_str;
+}
+
VALUE
rb_get_expanded_load_path(void)
{
@@ -106,7 +115,7 @@ rb_get_expanded_load_path(void)
int has_relative = 0, has_non_cache = 0;
rb_construct_expanded_load_path(EXPAND_ALL, &has_relative, &has_non_cache);
if (has_relative) {
- vm->load_path_check_cache = rb_dir_getwd_ospath();
+ vm->load_path_check_cache = load_path_getcwd();
}
else if (has_non_cache) {
/* Non string object. */
@@ -124,7 +133,7 @@ rb_get_expanded_load_path(void)
}
else if (vm->load_path_check_cache) {
int has_relative = 1, has_non_cache = 1;
- VALUE cwd = rb_dir_getwd_ospath();
+ VALUE cwd = load_path_getcwd();
if (!rb_str_equal(vm->load_path_check_cache, cwd)) {
/* Current working directory or filesystem encoding was changed.
Expand relative load path and non-cacheable objects again. */