/* * Compare this pathname with +other+. The comparison is string-based. * Be aware that two different paths (<tt>foo.txt</tt> and <tt>./foo.txt</tt>) * can refer to the same file. */ static VALUE path_eq(VALUE self, VALUE other) { if (!rb_obj_is_kind_of(other, rb_cPathname)) return Qfalse; return rb_str_equal(get_strpath(self), get_strpath(other)); }
VALUE rb_get_expanded_load_path(void) { rb_vm_t *vm = GET_VM(); const VALUE non_cache = Qtrue; if (!rb_ary_shared_with_p(vm->load_path_snapshot, vm->load_path)) { /* The load path was modified. Rebuild the expanded load path. */ 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 = load_path_getcwd(); } else if (has_non_cache) { /* Non string object. */ vm->load_path_check_cache = non_cache; } else { vm->load_path_check_cache = 0; } } else if (vm->load_path_check_cache == non_cache) { int has_relative = 1, has_non_cache = 1; /* Expand only non-cacheable objects. */ rb_construct_expanded_load_path(EXPAND_NON_CACHE, &has_relative, &has_non_cache); } else if (vm->load_path_check_cache) { int has_relative = 1, has_non_cache = 1; 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. */ vm->load_path_check_cache = cwd; rb_construct_expanded_load_path(EXPAND_RELATIVE, &has_relative, &has_non_cache); } else { /* Expand only tilde (User HOME) and non-cacheable objects. */ rb_construct_expanded_load_path(EXPAND_HOME, &has_relative, &has_non_cache); } } return vm->expanded_load_path; }
VALUE string_spec_rb_str_equal(VALUE self, VALUE str1, VALUE str2) { return rb_str_equal(str1, str2); }