summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-08 01:26:27 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-08 01:26:27 +0000
commit354028abe18bc5862a1b45e2f45060bf85c1ae35 (patch)
treee6da4f79a700852d9550e08adea365f93a5aba15 /file.c
parent885147037b37d8fc5424b95d82972c45c1151073 (diff)
file.c: rb_str_normalize_ospath
* file.c (rb_str_normalize_ospath): extract and move from dir.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r--file.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/file.c b/file.c
index ceed58d774..cfa10ae67d 100644
--- a/file.c
+++ b/file.c
@@ -240,6 +240,19 @@ rb_str_encode_ospath(VALUE path)
return path;
}
+#ifdef __APPLE__
+VALUE
+rb_str_normalize_ospath(const char *ptr, long len)
+{
+ rb_encoding *utf8mac = rb_enc_from_index(ENCINDEX_UTF8_MAC);
+ if (utf8mac) {
+ return rb_str_conv_enc(rb_tainted_str_new(ptr, len),
+ utf8mac, rb_utf8_encoding());
+ }
+ return Qnil;
+}
+#endif
+
static long
apply2files(void (*func)(const char *, VALUE, void *), VALUE vargs, void *arg)
{