diff options
| -rw-r--r-- | file.c | 9 | ||||
| -rw-r--r-- | internal/file.h | 1 | ||||
| -rw-r--r-- | pathname.c | 1 |
3 files changed, 10 insertions, 1 deletions
@@ -245,13 +245,20 @@ VALUE rb_get_path_check_convert(VALUE obj) { obj = file_path_convert(obj); + rb_get_path_check_no_convert(obj); + return rb_str_new_frozen(obj); +} +/* TODO: name */ +VALUE +rb_get_path_check_no_convert(VALUE obj) +{ check_path_encoding(obj); if (!rb_str_to_cstr(obj)) { rb_raise(rb_eArgError, "path name contains null byte"); } - return rb_str_new_frozen(obj); + return obj; } VALUE diff --git a/internal/file.h b/internal/file.h index 9c192ff4d1..29e9cdf4b9 100644 --- a/internal/file.h +++ b/internal/file.h @@ -23,6 +23,7 @@ VALUE rb_file_expand_path_fast(VALUE, VALUE); VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE); VALUE rb_get_path_check_to_string(VALUE); VALUE rb_get_path_check_convert(VALUE); +VALUE rb_get_path_check_no_convert(VALUE); int ruby_is_fd_loadable(int fd); RUBY_SYMBOL_EXPORT_BEGIN diff --git a/pathname.c b/pathname.c index 5f12d13767..28e25512a1 100644 --- a/pathname.c +++ b/pathname.c @@ -11,6 +11,7 @@ get_strpath(VALUE obj) strpath = rb_ivar_get(obj, id_at_path); if (!RB_TYPE_P(strpath, T_STRING)) rb_raise(rb_eTypeError, "unexpected @path"); + rb_get_path_check_no_convert(strpath); return strpath; } |
