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:
parent
3c534a09e9
commit
4d753671b2
2 changed files with 8 additions and 1 deletions
|
@ -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
4
dir.c
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue