mirror of
https://github.com/reactos/reactos.git
synced 2025-04-26 16:40:27 +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
|
do
|
||||||
{
|
{
|
||||||
bExclusion = FALSE;
|
bExclusion = FALSE;
|
||||||
|
|
||||||
/*if it is going to be excluded by - no need to check attrs*/
|
/*if it is going to be excluded by - no need to check attrs*/
|
||||||
if(*dwFlags & DEL_ATTRIBUTES && !bExclusion)
|
if(*dwFlags & DEL_ATTRIBUTES && !bExclusion)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*save if file attr check if user doesnt care about that attr anyways*/
|
/*save if file attr check if user doesnt care about that attr anyways*/
|
||||||
if(dwAttrFlags & ATTR_ARCHIVE && !(f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
if(dwAttrFlags & ATTR_ARCHIVE && !(f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
if(dwAttrFlags & ATTR_HIDDEN && !(f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
if(dwAttrFlags & ATTR_HIDDEN && !(f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
if(dwAttrFlags & ATTR_SYSTEM && !(f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
if(dwAttrFlags & ATTR_SYSTEM && !(f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
if(dwAttrFlags & ATTR_READ_ONLY && !(f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
if(dwAttrFlags & ATTR_READ_ONLY && !(f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
if(dwAttrFlags & ATTR_N_ARCHIVE && (f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
if(dwAttrFlags & ATTR_N_ARCHIVE && (f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
if(dwAttrFlags & ATTR_N_HIDDEN && (f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
if(dwAttrFlags & ATTR_N_HIDDEN && (f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
if(dwAttrFlags & ATTR_N_SYSTEM && (f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
if(dwAttrFlags & ATTR_N_SYSTEM && (f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
if(dwAttrFlags & ATTR_N_READ_ONLY && (f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
if(dwAttrFlags & ATTR_N_READ_ONLY && (f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||||
bExclusion = TRUE;
|
bExclusion = TRUE;
|
||||||
}
|
}
|
||||||
|
if(bExclusion)
|
||||||
|
continue;
|
||||||
|
|
||||||
if(bExclusion)
|
/* ignore directories */
|
||||||
continue;
|
if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
|
|
||||||
/* ignore directories */
|
|
||||||
if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
_tcscpy (pFilePart, f.cFileName);
|
_tcscpy (pFilePart, f.cFileName);
|
||||||
|
|
||||||
/* We cant delete ourselves */
|
/* We cant delete ourselves */
|
||||||
if(!_tcscmp (CMDPath,szFullPath))
|
if(!_tcscmp (CMDPath,szFullPath))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
TRACE("Full filename: %s\n", debugstr_aw(szFullPath));
|
TRACE("Full filename: %s\n", debugstr_aw(szFullPath));
|
||||||
|
|
||||||
/* ask for deleting */
|
/* ask for deleting */
|
||||||
if (*dwFlags & DEL_PROMPT)
|
if (*dwFlags & DEL_PROMPT)
|
||||||
{
|
{
|
||||||
ConErrResPrintf(STRING_DEL_ERROR5, szFullPath);
|
ConErrResPrintf(STRING_DEL_ERROR5, szFullPath);
|
||||||
|
|
||||||
res = FilePromptYN (STRING_DEL_ERROR6);
|
res = FilePromptYN (STRING_DEL_ERROR6);
|
||||||
|
@ -267,20 +266,20 @@ DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
||||||
|
|
||||||
if(RemoveFile (szFullPath, *dwFlags, &f))
|
if(RemoveFile (szFullPath, *dwFlags, &f))
|
||||||
dwFiles++;
|
dwFiles++;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ErrorMessage (GetLastError(), _T(""));
|
ErrorMessage (GetLastError(), _T(""));
|
||||||
// FindClose(hFile);
|
// FindClose(hFile);
|
||||||
// return -1;
|
// return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (FindNextFile (hFile, &f));
|
while (FindNextFile (hFile, &f));
|
||||||
FindClose (hFile);
|
FindClose (hFile);
|
||||||
}
|
}
|
||||||
|
else error_sfile_not_found(szFullPath);
|
||||||
return dwFiles;
|
return dwFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static DWORD
|
static DWORD
|
||||||
ProcessDirectory(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
ProcessDirectory(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue