Added !appendfile /RawNL switch
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6580 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
cd4363aca8
commit
d6d4da1bae
4 changed files with 24 additions and 18 deletions
|
@ -1407,18 +1407,25 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
case TOK_P_APPENDFILE:
|
||||
{
|
||||
WORD tok = 0, cp = 0;
|
||||
bool bom = false, forceEnc = false;
|
||||
TCHAR *param = line.gettoken_str(++tok), buf[9+1];
|
||||
my_strncpy(buf,param,COUNTOF(buf));
|
||||
if(!_tcsicmp(buf,_T("/charset=")))
|
||||
bool bom = false, forceEnc = false, rawnl = false;
|
||||
TCHAR *param, buf[9+!0];
|
||||
for (;;)
|
||||
{
|
||||
++tok, ++forceEnc, cp = GetEncodingFromString(param+9, bom);
|
||||
if (NStreamEncoding::UNKNOWN == cp)
|
||||
param = line.gettoken_str(++tok);
|
||||
my_strncpy(buf, param, COUNTOF(buf));
|
||||
if (!_tcsicmp(param,_T("/RawNL"))) ++rawnl;
|
||||
else if(!_tcsicmp(buf,_T("/CharSet=")))
|
||||
{
|
||||
ERROR_MSG(_T("!appendfile: Invalid parameter \"%") NPRIs _T("\"!\n"), param);
|
||||
return PS_ERROR;
|
||||
++forceEnc, cp = GetEncodingFromString(param+9, bom);
|
||||
if (NStreamEncoding::UNKNOWN == cp)
|
||||
{
|
||||
ERROR_MSG(_T("!appendfile: Invalid parameter \"%") NPRIs _T("\"!\n"), param);
|
||||
return PS_ERROR;
|
||||
}
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (line.getnumtokens() != 2 + tok) { PRINTHELP(); return PS_ERROR; }
|
||||
param = line.gettoken_str(tok);
|
||||
NOStream ostrm;
|
||||
if (!ostrm.CreateFileForAppending(param, NStreamEncoding::ACP))
|
||||
|
@ -1429,7 +1436,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
|||
if (ostrm.IsUnicode()) bom = false;
|
||||
if (forceEnc) ostrm.StreamEncoding().SetCodepage(cp);
|
||||
const TCHAR *const text = line.gettoken_str(++tok);
|
||||
if ((bom ? !ostrm.WriteBOM(ostrm.StreamEncoding()) : 0) || !ostrm.WriteString(text))
|
||||
bool succ = bom ? ostrm.WriteBOM(ostrm.StreamEncoding()) : true;
|
||||
if (!succ || rawnl ? !ostrm.WriteString(text) : !ostrm.WritePlatformNLString(text))
|
||||
{
|
||||
ERROR_MSG(_T("!appendfile: error writing to \"%") NPRIs _T("\".\n"), param);
|
||||
return PS_ERROR;
|
||||
|
|
|
@ -273,7 +273,7 @@ static tokenType tokenlist[TOK__LAST] =
|
|||
|
||||
{TOK_P_TEMPFILE,_T("!tempfile"),1,0,_T("symbol"),TP_ALL},
|
||||
{TOK_P_DELFILE,_T("!delfile"),1,1,_T("[/nonfatal] file"),TP_ALL},
|
||||
{TOK_P_APPENDFILE,_T("!appendfile"),2,1,_T("[/CHARSET=<") TSTR_OUTPUTCHARSET _T(">] file appended_line"),TP_ALL},
|
||||
{TOK_P_APPENDFILE,_T("!appendfile"),2,2,_T("[/CHARSET=<") TSTR_OUTPUTCHARSET _T(">] [/RAWNL] file appended_line"),TP_ALL},
|
||||
{TOK_P_GETDLLVERSION,_T("!getdllversion"),2,0,_T("localfilename define_basename"),TP_ALL},
|
||||
|
||||
{TOK_P_SEARCHPARSESTRING,_T("!searchparse"),3,-1,_T("[/ignorecase] [/noerrors] [/file] source_string substring OUTPUTSYM1 [substring [OUTPUTSYM2 [substring ...]]]"),TP_ALL},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue