Fix checking the file's existence

svn path=/trunk/; revision=27599
This commit is contained in:
Thomas Bluemel 2007-07-11 19:43:57 +00:00
parent 9dfc7b707b
commit 1c694b55bc

View file

@ -146,24 +146,11 @@ CreateShortcut(int csidl, LPCTSTR folder, UINT nIdName, LPCTSTR command, UINT nI
TCHAR title[256];
TCHAR name[256];
LPTSTR p = path;
TCHAR szSystemPath[MAX_PATH];
TCHAR szProgramPath[MAX_PATH];
TCHAR szWorkingDir[MAX_PATH];
LPTSTR lpWorkingDir = NULL;
LPTSTR lpFilePart;
DWORD dwLen;
if (bCheckExistence)
{
if (!GetSystemDirectory(szSystemPath, sizeof(szSystemPath)/sizeof(szSystemPath[0])))
return FALSE;
_tcscpy(szProgramPath, szSystemPath);
_tcscat(szProgramPath, _T("\\"));
if ((_taccess(_tcscat(szProgramPath, command), 0 )) == -1)
/* Expected error, don't return FALSE */
return TRUE;
}
if (ExpandEnvironmentStrings(command,
path,
sizeof(path) / sizeof(path[0])) == 0)
@ -172,6 +159,13 @@ CreateShortcut(int csidl, LPCTSTR folder, UINT nIdName, LPCTSTR command, UINT nI
command);
}
if (bCheckExistence)
{
if ((_taccess(path, 0 )) == -1)
/* Expected error, don't return FALSE */
return TRUE;
}
dwLen = GetFullPathName(path,
sizeof(szWorkingDir) / sizeof(szWorkingDir[0]),
szWorkingDir,