Skip to content

Commit 7f4bea5

Browse files
arobendscho
authored andcommitted
Make non-.exe externals work again
7ebac8c made launching of .exe externals work when installed in Unicode paths. But it broke launching of non-.exe externals, no matter where they were installed. We now correctly maintain the UTF-8 and UTF-16 paths in tandem in lookup_prog. This fixes t5526, among others. Signed-off-by: Adam Roben <[email protected]>
1 parent 43923ae commit 7f4bea5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compat/mingw.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,11 +1006,12 @@ static char *lookup_prog(const char *dir, int dirlen, const char *cmd,
10061006

10071007
if (!isexe && _waccess(wpath, F_OK) == 0)
10081008
return xstrdup(path);
1009-
path[strlen(path)-4] = '\0';
1009+
wpath[wcslen(wpath)-4] = '\0';
10101010
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
1011-
1012-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
1011+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
1012+
path[strlen(path)-4] = '\0';
10131013
return xstrdup(path);
1014+
}
10141015
}
10151016
return NULL;
10161017
}

0 commit comments

Comments
 (0)