Skip to content

Commit 15c16a0

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 29d0ce7 commit 15c16a0

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
@@ -958,11 +958,12 @@ static char *lookup_prog(const char *dir, int dirlen, const char *cmd,
958958

959959
if (!isexe && _waccess(wpath, F_OK) == 0)
960960
return xstrdup(path);
961-
path[strlen(path)-4] = '\0';
961+
wpath[wcslen(wpath)-4] = '\0';
962962
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
963-
964-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
963+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
964+
path[strlen(path)-4] = '\0';
965965
return xstrdup(path);
966+
}
966967
}
967968
return NULL;
968969
}

0 commit comments

Comments
 (0)