Skip to content

Commit ee27964

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 f485b6b commit ee27964

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

933933
if (!isexe && _waccess(wpath, F_OK) == 0)
934934
return xstrdup(path);
935-
path[strlen(path)-4] = '\0';
935+
wpath[wcslen(wpath)-4] = '\0';
936936
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {
937-
938-
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
937+
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
938+
path[strlen(path)-4] = '\0';
939939
return xstrdup(path);
940+
}
940941
}
941942
return NULL;
942943
}

0 commit comments

Comments
 (0)