1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

dir.c: make ASCII-8BIT

* dir.c (rb_dir_getwd): make ASCII-8BIT if filesystem encoding is
  US-ASCII, like as Dir.glob.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-04 15:53:53 +00:00
parent 3c534a09e9
commit 4d753671b2
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Mon Oct 5 00:53:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dir.c (rb_dir_getwd): make ASCII-8BIT if filesystem encoding is
US-ASCII, like as Dir.glob.
Sun Oct 4 23:39:09 2015 Tanaka Akira <akr@fsij.org>
* enum.c (nmin_filter): Fix limit value.

4
dir.c
View file

@ -1010,7 +1010,9 @@ rb_dir_getwd(void)
{
char *path;
VALUE cwd;
int fsenc = rb_enc_to_index(rb_filesystem_encoding());
if (fsenc == ENCINDEX_US_ASCII) fsenc = ENCINDEX_ASCII;
path = my_getcwd();
#ifdef __APPLE__
cwd = rb_str_normalize_ospath(path, strlen(path));
@ -1018,7 +1020,7 @@ rb_dir_getwd(void)
#else
cwd = rb_tainted_str_new2(path);
#endif
rb_enc_associate(cwd, rb_filesystem_encoding());
rb_enc_associate_index(cwd, fsenc);
xfree(path);
return cwd;