added !appendfile
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4322 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
e7bdb6aad8
commit
c94fdbf119
4 changed files with 39 additions and 0 deletions
|
@ -33,6 +33,19 @@ Causes the NSIS compiler to scan the given directory for plug-in DLLs.
|
|||
\c !addplugindir myplugin
|
||||
\c MyPlugin::SomeFunction
|
||||
|
||||
\S1{appendfile} !appendfile
|
||||
|
||||
\c file text
|
||||
|
||||
Appends \e{text} to \e{file}.
|
||||
|
||||
\c !tempfile FILE
|
||||
\c !appendfile "${FILE}" "XPStyle on$\n"
|
||||
\c !appendfile "${FILE}" "Name 'test'$\n"
|
||||
\c !include "${FILE}"
|
||||
\c !delfile "${FILE}"
|
||||
\c !undef FILE
|
||||
|
||||
\S1{cd} !cd
|
||||
|
||||
\c new_path
|
||||
|
|
|
@ -1069,6 +1069,30 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
SCRIPT_MSG("!delfile: \"%s\"\n", line.gettoken_str(1));
|
||||
return PS_OK;
|
||||
|
||||
case TOK_P_APPENDFILE:
|
||||
{
|
||||
char *file = line.gettoken_str(1);
|
||||
char *text = line.gettoken_str(2);
|
||||
|
||||
FILE *fp = FOPEN(file, "a");
|
||||
if (!fp)
|
||||
{
|
||||
ERROR_MSG("!appendfile: \"%s\" couldn't be opened.\n", file);
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
||||
if (fputs(text, fp) < 0)
|
||||
{
|
||||
ERROR_MSG("!appendfile: error writing to \"%s\".\n", file);
|
||||
return PS_ERROR;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
SCRIPT_MSG("!appendfile: \"%s\" \"%s\"\n", file, text);
|
||||
}
|
||||
return PS_OK;
|
||||
|
||||
// page ordering shit
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
|
||||
|
|
|
@ -244,6 +244,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
|
||||
{TOK_P_TEMPFILE,"!tempfile",1,0,"symbol",TP_ALL},
|
||||
{TOK_P_DELFILE,"!delfile",1,0,"file",TP_ALL},
|
||||
{TOK_P_APPENDFILE,"!appendfile",2,0,"file appended_line",TP_ALL},
|
||||
|
||||
{TOK_MISCBUTTONTEXT,"MiscButtonText",0,4,"[back button text] [next button text] [cancel button text] [close button text]",TP_GLOBAL},
|
||||
{TOK_DETAILSBUTTONTEXT,"DetailsButtonText",0,1,"[details button text]",TP_PG},
|
||||
|
|
|
@ -97,6 +97,7 @@ enum
|
|||
|
||||
TOK_P_TEMPFILE,
|
||||
TOK_P_DELFILE,
|
||||
TOK_P_APPENDFILE,
|
||||
|
||||
// section/function shit
|
||||
TOK_SECTION,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue