Fix literal caret handling in Windows path normalization and wildcard matching

This commit is contained in:
Andrea Mazzoleni 2026-08-26 15:09:30 +02:00
parent 670ab0195b
commit dd97bb2fa6
4 changed files with 130 additions and 23 deletions

View file

@ -1094,19 +1094,10 @@ void pathimport(char* dst, size_t size, const char* src)
pathcpy(dst, size, src);
#ifdef _WIN32
/*
* Convert the Windows dir separator '\' to C '/',
* and the Windows escaping char '^' to the fnmatch '\'
*/
/* Convert the Windows dir separator '\' to C '/' */
while (*dst) {
switch (*dst) {
case '\\' :
if (*dst == '\\')
*dst = '/';
break;
case '^' :
*dst = '\\';
break;
}
++dst;
}
#endif
@ -1117,16 +1108,10 @@ void pathexport(char* dst, size_t size, const char* src)
pathcpy(dst, size, src);
#ifdef _WIN32
/* invert the import */
/* Convert C '/' to Windows dir separator '\' */
while (*dst) {
switch (*dst) {
case '/' :
if (*dst == '/')
*dst = '\\';
break;
case '\\' :
*dst = '^';
break;
}
++dst;
}
#endif