mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (file_path_convert): delay getting UTF8-MAC encoding
while really needed. [ruby-core:26807] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0089bfe4dd
commit
07ae16d18c
2 changed files with 13 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Nov 21 14:44:16 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* file.c (file_path_convert): delay getting UTF8-MAC encoding
|
||||||
|
while really needed. [ruby-core:26807]
|
||||||
|
|
||||||
Fri Nov 20 21:16:54 2009 Tanaka Akira <akr@fsij.org>
|
Fri Nov 20 21:16:54 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* vm_eval.c (rb_search_method_entry): avoid trigraph.
|
* vm_eval.c (rb_search_method_entry): avoid trigraph.
|
||||||
|
|
15
file.c
15
file.c
|
@ -106,26 +106,27 @@ VALUE rb_cStat;
|
||||||
VALUE
|
VALUE
|
||||||
file_path_convert(VALUE name)
|
file_path_convert(VALUE name)
|
||||||
{
|
{
|
||||||
|
#ifndef _WIN32 /* non Windows == Unix */
|
||||||
rb_encoding *fname_encoding = rb_enc_from_index(ENCODING_GET(name));
|
rb_encoding *fname_encoding = rb_enc_from_index(ENCODING_GET(name));
|
||||||
rb_encoding *fs_encoding;
|
rb_encoding *fs_encoding;
|
||||||
#ifdef __APPLE__
|
# ifdef __APPLE__
|
||||||
static rb_encoding *utf8mac_encoding;
|
/* Mac OS X's file system encoding is UTF-8 */
|
||||||
if (!utf8mac_encoding)
|
|
||||||
utf8mac_encoding = rb_enc_find("UTF8-MAC");
|
|
||||||
if (rb_usascii_encoding() != fname_encoding
|
if (rb_usascii_encoding() != fname_encoding
|
||||||
&& rb_ascii8bit_encoding() != fname_encoding
|
&& rb_ascii8bit_encoding() != fname_encoding
|
||||||
&& rb_utf8_encoding() != fname_encoding
|
&& rb_utf8_encoding() != fname_encoding
|
||||||
&& utf8mac_encoding != fname_encoding
|
&& rb_enc_find("UTF8-MAC") != fname_encoding) {
|
||||||
&& (fs_encoding = rb_filesystem_encoding()) != fname_encoding) {
|
/* Don't call rb_enc_find() before UTF-8 */
|
||||||
name = rb_str_conv_enc(name, fname_encoding, fs_encoding);
|
name = rb_str_conv_enc(name, fname_encoding, fs_encoding);
|
||||||
}
|
}
|
||||||
#elif !defined(_WIN32)
|
# else /* Unix other than Mac OS X */
|
||||||
if (rb_default_internal_encoding() != NULL
|
if (rb_default_internal_encoding() != NULL
|
||||||
&& rb_usascii_encoding() != fname_encoding
|
&& rb_usascii_encoding() != fname_encoding
|
||||||
&& rb_ascii8bit_encoding() != fname_encoding
|
&& rb_ascii8bit_encoding() != fname_encoding
|
||||||
&& (fs_encoding = rb_filesystem_encoding()) != fname_encoding) {
|
&& (fs_encoding = rb_filesystem_encoding()) != fname_encoding) {
|
||||||
|
/* Don't call rb_filesystem_encoding() before US-ASCII and ASCII-8BIT */
|
||||||
name = rb_str_conv_enc(name, fname_encoding, fs_encoding);
|
name = rb_str_conv_enc(name, fname_encoding, fs_encoding);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue