Skip to content

Commit

Permalink
fixup! Add functionality for converting UNIX paths in arguments and e…
Browse files Browse the repository at this point in the history
…nvironment variables to Windows form for native Win32 applications.

This teaches MSYS2's path conversion to leave arguments starting with a
tilde or quote alone: It is not a good idea to expand, say, ~/.gitconfig
partially: replacing it by ~C:\msys64\.gitconfig is most likely the
wrong thing to do!

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Dec 2, 2023
1 parent 5ca03b6 commit af58c84
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions winsup/cygwin/msys2_path_conv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,13 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en

if (*it == '\0' || it == end) return NONE;

/* Let's not convert ~/.file to ~C:\msys64\.file */
if (*it == '~') {
skip_p2w:
*src = end;
return NONE;
}

while (!isalnum(*it) && *it != '/' && *it != '\\' && *it != ':' && *it != '-' && *it != '.') {
recurse = true;
it = ++*src;
Expand Down

0 comments on commit af58c84

Please sign in to comment.