Skip to content

Commit

Permalink
fix ParseCommandLine() fail when path name contains space.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Sep 4, 2017
1 parent 47a9704 commit bfddbf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions metapath/src/metapath.c
Expand Up @@ -2792,9 +2792,6 @@ void ParseCommandLine(void) {
lstrcpy(lp3, lp2);
continue;
}
if (state == 2) {
ExtractFirstArgument(lp3, lp1, lp2);
}
}

// pathname
Expand All @@ -2804,7 +2801,7 @@ void ParseCommandLine(void) {
}

lpPathArg = GlobalAlloc(GPTR, sizeof(WCHAR) * (MAX_PATH + 2));
StrCpyN(lpPathArg, lp1, MAX_PATH);
StrCpyN(lpPathArg, lp3, MAX_PATH);
break;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Notepad2.c
Expand Up @@ -6095,7 +6095,7 @@ void ParseCommandLine(void) {
lstrcpy(lp3, lp2);
continue;
}
if (state == 2) {
if (state == 2 && flagMultiFileArg == 2) {
ExtractFirstArgument(lp3, lp1, lp2);
}
}
Expand All @@ -6109,11 +6109,11 @@ void ParseCommandLine(void) {
}

lpFileArg = GlobalAlloc(GPTR, sizeof(WCHAR) * (MAX_PATH + 2)); // changed for ActivatePrevInst() needs
if (flagMultiFileArg == 1) {
// single file argument without quoted spaces
StrCpyN(lpFileArg, lp3, MAX_PATH);
} else {
if (flagMultiFileArg == 2) {
// multiple file arguments with quoted spaces
StrCpyN(lpFileArg, lp1, MAX_PATH);
} else {
StrCpyN(lpFileArg, lp3, MAX_PATH);
}

PathFixBackslashes(lpFileArg);
Expand Down

0 comments on commit bfddbf3

Please sign in to comment.