[PATCH 2 of 4] Consider that the last '\' character might be a part of MBCS
Shun-ichi Goto
shunichi.goto at gmail.com
Thu Jul 9 08:57:36 CDT 2009
# HG changeset patch
# User Shun-ichi GOTO <shunichi.goto at gmail.com>
# Date 1247143158 -32400
# Node ID aaafb9723679d3ba5e010347ac276a9037408d47
# Parent 1ea9bcb2d34907b0de2bba4cb2ed319a5f32b829
Consider that the last '\' character might be a part of MBCS.
diff -r 1ea9bcb2d349 -r aaafb9723679 mercurial/osutil.c
--- a/mercurial/osutil.c Wed Jul 08 09:48:48 2009 -0400
+++ b/mercurial/osutil.c Thu Jul 09 21:39:18 2009 +0900
@@ -200,6 +200,20 @@
char c = path[plen-1];
if (c != ':' && c != '/' && c != '\\')
pattern[plen++] = '\\';
+ else if (c == '\\') {
+ /* Decide the last '\' character is a part of multi byte
+ character or appended path separator by converting to wide
+ character string. */
+ pattern[--plen] = '\0';
+ if (MultiByteToWideChar(CP_ACP,
+ MB_PRECOMPOSED | MB_ERR_INVALID_CHARS,
+ pattern, plen,
+ NULL, 0) == 0) {
+ /* the last '\' is a part of MBCS, so recover it. */
+ pattern[plen++] = '\\';
+ }
+ pattern[plen++] = '\\';
+ }
}
strcpy(pattern + plen, "*");
More information about the Mercurial-devel
mailing list