Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 1b8301f

Browse files
arobenkasal
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 7ed7c52 commit 1b8301f

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

966966
if (!isexe && _waccess(wpath, F_OK) == 0)
967967
return xstrdup(path);
968-
path[strlen(path)-4] = '\0';
968+
wpath[wcslen(wpath)-4] = '\0';
969969
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
970-
971-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
970+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
971+
path[strlen(path)-4] = '\0';
972972
return xstrdup(path);
973+
}
973974
}
974975
return NULL;
975976
}

0 commit comments

Comments
 (0)