Skip to content

Commit 723ead6

Browse files
committed
updated for version 7.3.177
Problem: MS-Windows: mkdir() doesn't work properly when 'encoding' is "utf-8". Solution: Convert to utf-16. (Yukihiro Nakadaira)
1 parent 913fec0 commit 723ead6

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

src/os_win32.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,6 +2639,30 @@ mch_isdir(char_u *name)
26392639
return (f & FILE_ATTRIBUTE_DIRECTORY) != 0;
26402640
}
26412641

2642+
/*
2643+
* Create directory "name".
2644+
* Return 0 on success, -1 on error.
2645+
*/
2646+
int
2647+
mch_mkdir(char_u *name)
2648+
{
2649+
#ifdef FEAT_MBYTE
2650+
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
2651+
{
2652+
WCHAR *p;
2653+
int retval;
2654+
2655+
p = enc_to_utf16(name, NULL);
2656+
if (p == NULL)
2657+
return -1;
2658+
retval = _wmkdir(p);
2659+
vim_free(p);
2660+
return retval;
2661+
}
2662+
#endif
2663+
return _mkdir(name);
2664+
}
2665+
26422666
/*
26432667
* Return TRUE if file "fname" has more than one link.
26442668
*/

src/os_win32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,5 +191,5 @@ Trace(char *pszFormat, ...);
191191
#ifdef __BORLANDC__
192192
# define vim_mkdir(x, y) mkdir(x)
193193
#else
194-
# define vim_mkdir(x, y) _mkdir(x)
194+
# define vim_mkdir(x, y) mch_mkdir(x)
195195
#endif

src/proto/os_win32.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ long mch_getperm __ARGS((char_u *name));
2020
int mch_setperm __ARGS((char_u *name, long perm));
2121
void mch_hide __ARGS((char_u *name));
2222
int mch_isdir __ARGS((char_u *name));
23+
int mch_mkdir __ARGS((char_u *name));
2324
int mch_is_linked __ARGS((char_u *fname));
2425
int win32_fileinfo __ARGS((char_u *name, BY_HANDLE_FILE_INFORMATION *lpFileInfo));
2526
int mch_writable __ARGS((char_u *name));

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ static char *(features[]) =
714714

715715
static int included_patches[] =
716716
{ /* Add new patch number below this line */
717+
/**/
718+
177,
717719
/**/
718720
176,
719721
/**/

0 commit comments

Comments
 (0)