mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
Give an error message when trying to DEL a file that doesn't exist (Bug 4244). Patch by Victor Martinez <vicmarcal at hotmail.com>.
svn path=/trunk/; revision=39944
This commit is contained in:
parent
947cbd765b
commit
db0b0ba158
1 changed files with 37 additions and 38 deletions
|
@ -199,51 +199,50 @@ DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
|||
{
|
||||
do
|
||||
{
|
||||
bExclusion = FALSE;
|
||||
bExclusion = FALSE;
|
||||
|
||||
/*if it is going to be excluded by - no need to check attrs*/
|
||||
if(*dwFlags & DEL_ATTRIBUTES && !bExclusion)
|
||||
{
|
||||
/*if it is going to be excluded by - no need to check attrs*/
|
||||
if(*dwFlags & DEL_ATTRIBUTES && !bExclusion)
|
||||
{
|
||||
|
||||
/*save if file attr check if user doesnt care about that attr anyways*/
|
||||
if(dwAttrFlags & ATTR_ARCHIVE && !(f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
||||
/*save if file attr check if user doesnt care about that attr anyways*/
|
||||
if(dwAttrFlags & ATTR_ARCHIVE && !(f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_HIDDEN && !(f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
||||
if(dwAttrFlags & ATTR_HIDDEN && !(f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_SYSTEM && !(f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
||||
if(dwAttrFlags & ATTR_SYSTEM && !(f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_READ_ONLY && !(f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_ARCHIVE && (f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_HIDDEN && (f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_SYSTEM && (f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_READ_ONLY && (f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
bExclusion = TRUE;
|
||||
}
|
||||
if(dwAttrFlags & ATTR_READ_ONLY && !(f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_ARCHIVE && (f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_HIDDEN && (f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_SYSTEM && (f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
||||
bExclusion = TRUE;
|
||||
if(dwAttrFlags & ATTR_N_READ_ONLY && (f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
bExclusion = TRUE;
|
||||
}
|
||||
if(bExclusion)
|
||||
continue;
|
||||
|
||||
if(bExclusion)
|
||||
continue;
|
||||
|
||||
/* ignore directories */
|
||||
if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
/* ignore directories */
|
||||
if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
continue;
|
||||
|
||||
|
||||
_tcscpy (pFilePart, f.cFileName);
|
||||
_tcscpy (pFilePart, f.cFileName);
|
||||
|
||||
/* We cant delete ourselves */
|
||||
if(!_tcscmp (CMDPath,szFullPath))
|
||||
continue;
|
||||
/* We cant delete ourselves */
|
||||
if(!_tcscmp (CMDPath,szFullPath))
|
||||
continue;
|
||||
|
||||
|
||||
TRACE("Full filename: %s\n", debugstr_aw(szFullPath));
|
||||
TRACE("Full filename: %s\n", debugstr_aw(szFullPath));
|
||||
|
||||
/* ask for deleting */
|
||||
if (*dwFlags & DEL_PROMPT)
|
||||
{
|
||||
/* ask for deleting */
|
||||
if (*dwFlags & DEL_PROMPT)
|
||||
{
|
||||
ConErrResPrintf(STRING_DEL_ERROR5, szFullPath);
|
||||
|
||||
res = FilePromptYN (STRING_DEL_ERROR6);
|
||||
|
@ -267,20 +266,20 @@ DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
|||
|
||||
if(RemoveFile (szFullPath, *dwFlags, &f))
|
||||
dwFiles++;
|
||||
else
|
||||
else
|
||||
{
|
||||
ErrorMessage (GetLastError(), _T(""));
|
||||
ErrorMessage (GetLastError(), _T(""));
|
||||
// FindClose(hFile);
|
||||
// return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (FindNextFile (hFile, &f));
|
||||
FindClose (hFile);
|
||||
}
|
||||
FindClose (hFile);
|
||||
}
|
||||
else error_sfile_not_found(szFullPath);
|
||||
return dwFiles;
|
||||
}
|
||||
|
||||
|
||||
static DWORD
|
||||
ProcessDirectory(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue