patch 8.2.4875: MS-Windows: some .exe files are not recognized
Problem: MS-Windows: some .exe files are not recognized.
Solution: Parse APPEXECLINK junctions. (closes #10302)
diff --git a/src/os_win32.c b/src/os_win32.c
index 97595d6..7224fad 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -2127,13 +2127,27 @@
static int
executable_file(char *name, char_u **path)
{
- if (mch_getperm((char_u *)name) != -1 && !mch_isdir((char_u *)name))
+ int attrs = win32_getattrs((char_u *)name);
+
+ // The file doesn't exist or is a folder.
+ if (attrs == -1 || (attrs & FILE_ATTRIBUTE_DIRECTORY))
+ return FALSE;
+ // Check if the file is an AppExecLink, a special alias used by Windows
+ // Store for its apps.
+ if (attrs & FILE_ATTRIBUTE_REPARSE_POINT)
{
+ char_u *res = resolve_appexeclink((char_u *)name);
+ if (res == NULL)
+ return FALSE;
+ // The path is already absolute.
if (path != NULL)
- *path = FullName_save((char_u *)name, FALSE);
- return TRUE;
+ *path = res;
+ else
+ vim_free(res);
}
- return FALSE;
+ else if (path != NULL)
+ *path = FullName_save((char_u *)name, FALSE);
+ return TRUE;
}
/*