Skip to content

Commit

Permalink
Make non-.exe externals work again
Browse files Browse the repository at this point in the history
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 <adam@roben.org>
  • Loading branch information
aroben authored and dscho committed May 8, 2019
1 parent ed224b9 commit bfe6c11
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1169,11 +1169,12 @@ static char *lookup_prog(const char *dir, int dirlen, const char *cmd,

if (!isexe && _waccess(wpath, F_OK) == 0)
return xstrdup(path);
path[strlen(path)-4] = '\0';
wpath[wcslen(wpath)-4] = '\0';
if ((!exe_only || isexe) && _waccess(wpath, F_OK) == 0) {

if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY))
if (!(GetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)) {
path[strlen(path)-4] = '\0';
return xstrdup(path);
}
}
return NULL;
}
Expand Down

0 comments on commit bfe6c11

Please sign in to comment.