Skip to content

Commit aa5a337

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 91aa527 commit aa5a337

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

895895
if (!isexe && _waccess(wpath, F_OK) == 0)
896896
return xstrdup(path);
897-
path[strlen(path)-4] = '\0';
897+
wpath[wcslen(wpath)-4] = '\0';
898898
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
899-
900-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
899+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
900+
path[strlen(path)-4] = '\0';
901901
return xstrdup(path);
902+
}
902903
}
903904
return NULL;
904905
}

0 commit comments

Comments
 (0)