Add support for escaping in Windows with the '^' char

This commit is contained in:
Andrea Mazzoleni 2016-03-02 12:05:38 +01:00
parent ecff017ffe
commit 8fbd8b35ea
5 changed files with 45 additions and 7 deletions

View file

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