summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 02:16:31 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-20 18:34:04 +0900
commit5b98b2ce39ed979aec614365a2dc3e1c30052bca (patch)
tree975744f4a5cd9e523f8e319dd6d017c08580de21 /win32
parentfeea436febb50eb4265bd985a550e384c606122c (diff)
win32: Use UTF-8 as filesystem encoding [Feature #12654]
Co-Authored-By: Dāvis Mosāns <davispuh@gmail.com>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3948
Diffstat (limited to 'win32')
-rw-r--r--win32/dir.h3
-rw-r--r--win32/file.c2
-rw-r--r--win32/win32.c2
3 files changed, 4 insertions, 3 deletions
diff --git a/win32/dir.h b/win32/dir.h
index a075980..28fbb6c 100644
--- a/win32/dir.h
+++ b/win32/dir.h
@@ -38,11 +38,12 @@ void rb_w32_rewinddir(DIR *);
void rb_w32_closedir(DIR *);
char *rb_w32_ugetcwd(char *, int);
-#define opendir(s) rb_w32_opendir((s))
+#define opendir(s) rb_w32_uopendir((s))
#define readdir(d) rb_w32_readdir((d), 0)
#define telldir(d) rb_w32_telldir((d))
#define seekdir(d, l) rb_w32_seekdir((d), (l))
#define rewinddir(d) rb_w32_rewinddir((d))
#define closedir(d) rb_w32_closedir((d))
+#define getcwd(b, s) rb_w32_ugetcwd(b, s)
#endif /* RUBY_WIN32_DIR_H */
diff --git a/win32/file.c b/win32/file.c
index 7132024..5c34bd4 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -347,7 +347,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
if (path_cp == INVALID_CODE_PAGE || rb_enc_str_asciionly_p(path)) {
/* use filesystem encoding if expanding home dir */
path_encoding = rb_filesystem_encoding();
- cp = path_cp = system_code_page();
+ cp = path_cp = code_page(path_encoding);
}
/* ignores dir since we are expanding home */
diff --git a/win32/win32.c b/win32/win32.c
index 5904082..4f0c0d2 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2270,7 +2270,7 @@ rb_w32_conv_from_wstr(const WCHAR *wstr, long *lenp, rb_encoding *enc)
long len;
char *ptr;
- if (NIL_P(str)) return wstr_to_filecp(wstr, lenp);
+ if (NIL_P(str)) return wstr_to_utf8(wstr, lenp);
*lenp = len = RSTRING_LEN(str);
memcpy(ptr = malloc(len + 1), RSTRING_PTR(str), len);
ptr[len] = '\0';