Skip to content

Commit 7225580

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 9e6b28d commit 7225580

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

11701170
if (!isexe && _waccess(wpath, F_OK) == 0)
11711171
return xstrdup(path);
1172-
path[strlen(path)-4] = '\0';
1172+
wpath[wcslen(wpath)-4] = '\0';
11731173
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
1174-
1175-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
1174+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
1175+
path[strlen(path)-4] = '\0';
11761176
return xstrdup(path);
1177+
}
11771178
}
11781179
return NULL;
11791180
}

0 commit comments

Comments
 (0)