Skip to content

Commit

Permalink
Fix metapath can't open quoted path.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Nov 1, 2018
1 parent cd0cbe4 commit db1b22b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions metapath/src/Helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,21 @@ void StrTab2Space(LPWSTR lpsz) {
}
}

//=============================================================================
//
// PathFixBackslashes() - in place conversion
//
void PathFixBackslashes(LPWSTR lpsz) {
WCHAR *c = lpsz;
while ((c = StrChr(c, L'/')) != NULL) {
if (*CharPrev(lpsz, c) == L':' && *CharNext(c) == L'/') {
c += 2;
} else {
*c = L'\\';
}
}
}

//=============================================================================
//
// ExpandEnvironmentStringsEx()
Expand Down
1 change: 1 addition & 0 deletions metapath/src/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ LPWSTR GetFilenameStr(LPWSTR lpFile);

void PrepareFilterStr(LPWSTR lpFilter);
void StrTab2Space(LPWSTR lpsz);
void PathFixBackslashes(LPWSTR lpsz);
void ExpandEnvironmentStringsEx(LPWSTR lpSrc, DWORD dwSrc);
void PathCanonicalizeEx(LPWSTR lpSrc);
DWORD SearchPathEx(LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension,
Expand Down
2 changes: 2 additions & 0 deletions metapath/src/metapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -2796,6 +2796,8 @@ void ParseCommandLine(void) {

lpPathArg = GlobalAlloc(GPTR, sizeof(WCHAR) * (MAX_PATH + 2));
lstrcpyn(lpPathArg, lp3, MAX_PATH);
PathFixBackslashes(lpPathArg);
StrTrim(lpPathArg, L" \"");
break;
}
}
Expand Down

0 comments on commit db1b22b

Please sign in to comment.