mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
Fix checking the file's existence
svn path=/trunk/; revision=27599
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user