Skip to content

Commit c89d715

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 c149cf2 commit c89d715

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

936936
if (!isexe && _waccess(wpath, F_OK) == 0)
937937
return xstrdup(path);
938-
path[strlen(path)-4] = '\0';
938+
wpath[wcslen(wpath)-4] = '\0';
939939
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
940-
941-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
940+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
941+
path[strlen(path)-4] = '\0';
942942
return xstrdup(path);
943+
}
943944
}
944945
return NULL;
945946
}

0 commit comments

Comments
 (0)