1
0
forked from aniani/vim

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)
This commit is contained in:
LemonBoy
2022-05-05 20:18:16 +01:00
committed by Bram Moolenaar
parent 365d8f76b5
commit 40fd7e6652
6 changed files with 158 additions and 4 deletions

View File

@@ -2127,13 +2127,27 @@ theend:
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;
}
/*