Skip to content

Commit dc36af7

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 94a54c6 commit dc36af7

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
@@ -877,11 +877,12 @@ static char *lookup_prog(const char *dir, const char *cmd, int isexe, int exe_on
877877

878878
if (!isexe && _waccess(wpath, F_OK) == 0)
879879
return xstrdup(path);
880-
path[strlen(path)-4] = '\0';
880+
wpath[wcslen(wpath)-4] = '\0';
881881
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
882-
883-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
882+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
883+
path[strlen(path)-4] = '\0';
884884
return xstrdup(path);
885+
}
885886
}
886887
return NULL;
887888
}

0 commit comments

Comments
 (0)