From b0a565de930df8dc4fd8f00cbfe3a585391cb05a Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 28 Feb 2018 16:48:33 +0000 Subject: win32: don't add extensions to filenames ending with a dot A filename ending with a dot is a signal to spawnve not to try adding extensions but to use the name unmodified. The add_win32_extension function should follow the same rule. --- win32/mingw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'win32') diff --git a/win32/mingw.c b/win32/mingw.c index 22e62232d..260bc82d7 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -1033,6 +1033,12 @@ int has_exe_suffix(const char *name) return has_win_suffix(name, 0); } +int has_exe_suffix_or_dot(const char *name) +{ + int len = strlen(name); + return (len > 0 && name[len-1] == '.') || has_win_suffix(name, 0); +} + /* check if path can be made into an executable by adding a suffix; * return an allocated string containing the path if it can; * return NULL if not. @@ -1044,7 +1050,7 @@ char *add_win32_extension(const char *p) char *path; int i, len; - if (has_exe_suffix(p)) { + if (has_exe_suffix_or_dot(p)) { return NULL; } -- cgit v1.2.3-55-g6feb