RMDir /REBOOTOK

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2390 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2003-03-29 11:45:22 +00:00
parent 5fbadb7e97
commit 68c97de740
4 changed files with 21 additions and 5 deletions

View file

@ -537,7 +537,7 @@ static int NSISCALL ExecuteEntry(entry *entry_)
if (lastchar(buf0)=='\\') trimslashtoend(buf0);
doRMDir(buf0,parm1);
if (file_exists(buf0)) g_flags.exec_error++;
if (file_exists(buf0) && parm1!=2) g_flags.exec_error++;
}
return 0;
#endif//NSIS_SUPPORT_RMDIR

View file

@ -73,11 +73,11 @@ void * NSISCALL my_GlobalAlloc(DWORD dwBytes) {
}
#ifdef NSIS_SUPPORT_RMDIR
void NSISCALL doRMDir(char *buf, int recurse)
void NSISCALL doRMDir(char *buf, int flags) // 1 - recurse, 2 - rebootok
{
if (is_valid_instpath(buf))
{
if (recurse) {
if (flags&1) {
SHFILEOPSTRUCT op;
op.hwnd=0;
@ -90,7 +90,17 @@ void NSISCALL doRMDir(char *buf, int recurse)
SHFileOperation(&op);
}
#ifdef NSIS_SUPPORT_MOVEONREBOOT
else if (!RemoveDirectory(buf) && flags&2) {
log_printf2("Remove folder on reboot: %s",buf);
#ifdef NSIS_SUPPORT_REBOOT
g_flags.exec_reboot++;
#endif
MoveFileOnReboot(buf,0);
}
#else
else RemoveDirectory(buf);
#endif
}
log_printf2("RMDir: RemoveDirectory(\"%s\")",buf);
update_status_text_from_lang(LANG_REMOVEDIR,buf);

View file

@ -3021,9 +3021,15 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
a++;
ent.offsets[1]=1;
}
else if (!stricmp(line.gettoken_str(1),"/REBOOTOK"))
{
if (line.getnumtokens() < 3) PRINTHELP()
a++;
ent.offsets[1]=2;
}
else if (line.gettoken_str(1)[0]=='/') PRINTHELP()
ent.offsets[0]=add_string(line.gettoken_str(a));
SCRIPT_MSG("RMDir: %s\"%s\"\n",ent.offsets[1]?"/r " : "",line.gettoken_str(a));
SCRIPT_MSG("RMDir: %s%s\"%s\"\n",a==1?"":line.gettoken_str(1),ent.offsets[1]?" ":"",line.gettoken_str(a));
}
return add_entry(&ent);
#else//!NSIS_SUPPORT_RMDIR

View file

@ -124,7 +124,7 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_REGDLL,"RegDLL",1,1,"dll_path_on_target.dll [entrypoint_symbol]"},
{TOK_RENAME,"Rename",2,1,"[/REBOOTOK] source_file destination_file"},
{TOK_RET,"Return",0,0,""},
{TOK_RMDIR,"RMDir",1,1,"[/r] directory_name"},
{TOK_RMDIR,"RMDir",1,1,"[/r|/REBOOTOK] directory_name"},
{TOK_SECTION,"Section",0,3,"[/e] [section_name|-section_name] [section index output]"},
{TOK_SUBSECTION,"SubSection",1,2,"[/e] subsection_name [section index output]"},
{TOK_SUBSECTIONEND,"SubSectionEnd",0,0,""},