converted RMDir back from SHFileOperation to the good old manual method

- RMDir can now be used with both /r and /REBOOTOK
- RMDir /r no longer leaves lots of files behind if one file removal failed
- The plug-ins directory is now always deleted, if not immediately, then after reboot
- RMDir /r prints a detailed log of its actions


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3597 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-08-06 17:03:07 +00:00
parent 7270abe8d3
commit 010dc75a71
8 changed files with 141 additions and 87 deletions

View file

@ -487,46 +487,9 @@ static int NSISCALL ExecuteEntry(entry *entry_)
#ifdef NSIS_SUPPORT_DELETE
case EW_DELETEFILE:
{
HANDLE h;
WIN32_FIND_DATA fd;
char *buf1=GetStringFromParm(0x10);
mystrcpy(buf0,buf1);
char *buf0=GetStringFromParm(0x00);
log_printf2("Delete: \"%s\"",buf0);
trimslashtoend(buf0);
h=FindFirstFile(buf1,&fd);
if (h != INVALID_HANDLE_VALUE)
{
do
{
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
wsprintf(buf1,"%s\\%s",buf0,fd.cFileName);
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
SetFileAttributes(buf1,fd.dwFileAttributes^FILE_ATTRIBUTE_READONLY);
if (DeleteFile(buf1))
{
log_printf2("Delete: DeleteFile(\"%s\")",buf1);
update_status_text_buf1(LANG_DELETEFILE);
}
else
{
#ifdef NSIS_SUPPORT_MOVEONREBOOT
if (parm1)
{
log_printf2("Delete: DeleteFile on Reboot(\"%s\")",buf1);
update_status_text_buf1(LANG_DELETEONREBOOT);
MoveFileOnReboot(buf1,NULL);
}
else
#endif
{
exec_error++;
}
}
}
} while (FindNextFile(h,&fd));
FindClose(h);
}
myDelete(buf0,parm1);
}
break;
#endif//NSIS_SUPPORT_DELETE
@ -558,9 +521,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
char *buf1=GetStringFromParm(-0x10);
log_printf2("RMDir: \"%s\"",buf1);
doRMDir(buf1,parm1);
if (file_exists(buf1) && parm1!=2) exec_error++;
else update_status_text_buf1(LANG_REMOVEDIR);
myDelete(buf1,parm1);
}
break;
#endif//NSIS_SUPPORT_RMDIR
@ -1178,7 +1139,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
{
char *buf3=GetStringFromParm(0x33);
res = RegDeleteValue(hKey,buf3);
log_printf4("DeleteRegValue: %d\\%s\\%s",rootkey,buf2,buf3);
log_printf4("DeleteRegValue: %d\\%s\\%s",parm1,buf2,buf3);
RegCloseKey(hKey);
}
}