зеркало из https://github.com/github/ruby.git
revert previous changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
1ebed6c614
Коммит
a928613a31
22
file.c
22
file.c
|
@ -107,6 +107,7 @@ rb_get_path_check(VALUE obj, int check)
|
|||
tmp = rb_check_string_type(obj);
|
||||
if (!NIL_P(tmp)) goto exit;
|
||||
|
||||
|
||||
CONST_ID(to_path, "to_path");
|
||||
if (rb_respond_to(obj, to_path)) {
|
||||
tmp = rb_funcall(obj, to_path, 0, 0);
|
||||
|
@ -119,27 +120,6 @@ rb_get_path_check(VALUE obj, int check)
|
|||
if (check && obj != tmp) {
|
||||
rb_check_safe_obj(tmp);
|
||||
}
|
||||
|
||||
#if defined _WIN32 || defined __APPLE__
|
||||
{
|
||||
static rb_encoding *fs_encoding;
|
||||
rb_encoding *fname_encoding = rb_enc_get(tmp);
|
||||
if (!fs_encoding)
|
||||
fs_encoding = rb_filesystem_encoding();
|
||||
if (rb_usascii_encoding() != fname_encoding
|
||||
&& rb_ascii8bit_encoding() != fname_encoding
|
||||
#if defined __APPLE__
|
||||
&& rb_utf8_encoding() != fname_encoding
|
||||
#endif
|
||||
&& fs_encoding != fname_encoding) {
|
||||
static VALUE fs_enc;
|
||||
if (!fs_enc)
|
||||
fs_enc = rb_enc_from_encoding(fs_encoding);
|
||||
tmp = rb_str_encode(tmp, fs_enc, 0, Qnil);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return rb_str_new4(tmp);
|
||||
}
|
||||
|
||||
|
|
19
io.c
19
io.c
|
@ -4885,6 +4885,25 @@ rb_scan_open_args(int argc, VALUE *argv,
|
|||
opt = pop_last_hash(&argc, argv);
|
||||
rb_scan_args(argc, argv, "12", &fname, &vmode, &vperm);
|
||||
FilePathValue(fname);
|
||||
#if defined _WIN32 || defined __APPLE__
|
||||
{
|
||||
static rb_encoding *fs_encoding;
|
||||
rb_encoding *fname_encoding = rb_enc_get(fname);
|
||||
if (!fs_encoding)
|
||||
fs_encoding = rb_filesystem_encoding();
|
||||
if (rb_usascii_encoding() != fname_encoding
|
||||
&& rb_ascii8bit_encoding() != fname_encoding
|
||||
#if defined __APPLE__
|
||||
&& rb_utf8_encoding() != fname_encoding
|
||||
#endif
|
||||
&& fs_encoding != fname_encoding) {
|
||||
static VALUE fs_enc;
|
||||
if (!fs_enc)
|
||||
fs_enc = rb_enc_from_encoding(fs_encoding);
|
||||
fname = rb_str_encode(fname, fs_enc, 0, Qnil);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rb_io_extract_modeenc(&vmode, &vperm, opt, &oflags, &fmode, convconfig_p);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче