mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 10:28:45 +00:00
Fix checking the file's existence
svn path=/trunk/; revision=27599
This commit is contained in:
parent
9dfc7b707b
commit
1c694b55bc
1 changed files with 7 additions and 13 deletions
|
@ -146,24 +146,11 @@ CreateShortcut(int csidl, LPCTSTR folder, UINT nIdName, LPCTSTR command, UINT nI
|
||||||
TCHAR title[256];
|
TCHAR title[256];
|
||||||
TCHAR name[256];
|
TCHAR name[256];
|
||||||
LPTSTR p = path;
|
LPTSTR p = path;
|
||||||
TCHAR szSystemPath[MAX_PATH];
|
|
||||||
TCHAR szProgramPath[MAX_PATH];
|
|
||||||
TCHAR szWorkingDir[MAX_PATH];
|
TCHAR szWorkingDir[MAX_PATH];
|
||||||
LPTSTR lpWorkingDir = NULL;
|
LPTSTR lpWorkingDir = NULL;
|
||||||
LPTSTR lpFilePart;
|
LPTSTR lpFilePart;
|
||||||
DWORD dwLen;
|
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,
|
if (ExpandEnvironmentStrings(command,
|
||||||
path,
|
path,
|
||||||
sizeof(path) / sizeof(path[0])) == 0)
|
sizeof(path) / sizeof(path[0])) == 0)
|
||||||
|
@ -172,6 +159,13 @@ CreateShortcut(int csidl, LPCTSTR folder, UINT nIdName, LPCTSTR command, UINT nI
|
||||||
command);
|
command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bCheckExistence)
|
||||||
|
{
|
||||||
|
if ((_taccess(path, 0 )) == -1)
|
||||||
|
/* Expected error, don't return FALSE */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
dwLen = GetFullPathName(path,
|
dwLen = GetFullPathName(path,
|
||||||
sizeof(szWorkingDir) / sizeof(szWorkingDir[0]),
|
sizeof(szWorkingDir) / sizeof(szWorkingDir[0]),
|
||||||
szWorkingDir,
|
szWorkingDir,
|
||||||
|
|
Loading…
Reference in a new issue