From: Joe Souza <jsouza(a)yahoo.com> --- programs/cmd/wcmdmain.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index fbec86a481a..31fa5e795b9 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -193,12 +193,25 @@ static void find_insert_pos(const WCHAR *inputBuffer, int len, SEARCH_CONTEXT *s /* Handle paths here. Find last '\\' or other delimiter. * If not found then insert pos is the same as search pos. */ - while (cc > sc->search_pos && !wcschr(INTRA_PATH_DELIMS, inputBuffer[cc])) { - cc--; - } + if (sc->user_specified_quotes) { + /* If the user specified quotes then treat the usual delimiters as literals + * and ignore them. + */ + while (cc > sc->search_pos && inputBuffer[cc] != L'\\') { + cc--; + } + + if (inputBuffer[cc] == L'\"' || inputBuffer[cc] == L'\\') { + cc++; + } + } else { + while (cc > sc->search_pos && !wcschr(INTRA_PATH_DELIMS, inputBuffer[cc])) { + cc--; + } - if (inputBuffer[cc] == L'\"' || wcschr(INTRA_PATH_DELIMS, inputBuffer[cc])) { - cc++; + if (inputBuffer[cc] == L'\"' || wcschr(INTRA_PATH_DELIMS, inputBuffer[cc])) { + cc++; + } } sc->insert_pos = cc; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8573