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
|
@ -40,9 +40,9 @@ Causes the NSIS compiler to scan the given directory for plug-in DLLs. If you do
|
||||||
|
|
||||||
\# NOTE: \NsisOutputCharset define cannot be used in a \c block
|
\# NOTE: \NsisOutputCharset define cannot be used in a \c block
|
||||||
|
|
||||||
\c [/CHARSET=ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]] file text
|
\c [/CHARSET=ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]] [/RawNL] file text
|
||||||
|
|
||||||
Appends \e{text} to \e{file}. The text is written as ANSI (ACP) unless the file already has a BOM. Using /CHARSET will force a specific character encoding.
|
Appends \e{text} to \e{file}. The text is written as ANSI (ACP) unless the file already has a BOM. Using /CHARSET will force a specific character encoding. \c{$\\n} will be translated to \c{$\\r$\\n} on Windows unless you specify /RawNL.
|
||||||
|
|
||||||
\c !tempfile FILE
|
\c !tempfile FILE
|
||||||
\c !appendfile "${FILE}" "XPStyle on$\n"
|
\c !appendfile "${FILE}" "XPStyle on$\n"
|
||||||
|
|
|
@ -12,13 +12,11 @@ Released on ?, 201?
|
||||||
|
|
||||||
\S2{} Minor Changes
|
\S2{} Minor Changes
|
||||||
|
|
||||||
|
\b Added !appendfile /RawNL switch
|
||||||
|
|
||||||
\b Exec[Wait] sets the CREATE_DEFAULT_ERROR_MODE flag when creating a process
|
\b Exec[Wait] sets the CREATE_DEFAULT_ERROR_MODE flag when creating a process
|
||||||
|
|
||||||
\b Fixed minor issues in the Pascal NSIS plug-in SDK and removed the extrap global variable
|
\b Fixed minor issues in the Pascal NSIS plug-in SDK and removed the \cw{extrap} global variable
|
||||||
|
|
||||||
\S1{v3.0b2-cl} Changelog
|
|
||||||
|
|
||||||
\S2{} Minor Changes
|
|
||||||
|
|
||||||
\b Windows 10 support
|
\b Windows 10 support
|
||||||
|
|
||||||
|
@ -40,7 +38,7 @@ Released on October 6th, 2014
|
||||||
|
|
||||||
\b Added new MUI2 bitmap stretch modes, *_NOSTRETCH is now deprecated (\W{http://sf.net/p/nsis/feature-requests/521}{RFE #521})
|
\b Added new MUI2 bitmap stretch modes, *_NOSTRETCH is now deprecated (\W{http://sf.net/p/nsis/feature-requests/521}{RFE #521})
|
||||||
|
|
||||||
\b InitiateShutdown is used to reboot the machine if available (\W{http://sf.net/p/nsis/patches/247}{patch #247})
|
\b \c{InitiateShutdown()} is used to reboot the machine if available (\W{http://sf.net/p/nsis/patches/247}{patch #247})
|
||||||
|
|
||||||
\b Added PPO and SafePPO preprocess-only compiler switches
|
\b Added PPO and SafePPO preprocess-only compiler switches
|
||||||
|
|
||||||
|
|
|
@ -1407,18 +1407,25 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
case TOK_P_APPENDFILE:
|
case TOK_P_APPENDFILE:
|
||||||
{
|
{
|
||||||
WORD tok = 0, cp = 0;
|
WORD tok = 0, cp = 0;
|
||||||
bool bom = false, forceEnc = false;
|
bool bom = false, forceEnc = false, rawnl = false;
|
||||||
TCHAR *param = line.gettoken_str(++tok), buf[9+1];
|
TCHAR *param, buf[9+!0];
|
||||||
my_strncpy(buf,param,COUNTOF(buf));
|
for (;;)
|
||||||
if(!_tcsicmp(buf,_T("/charset=")))
|
|
||||||
{
|
{
|
||||||
++tok, ++forceEnc, cp = GetEncodingFromString(param+9, bom);
|
param = line.gettoken_str(++tok);
|
||||||
if (NStreamEncoding::UNKNOWN == cp)
|
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);
|
++forceEnc, cp = GetEncodingFromString(param+9, bom);
|
||||||
return PS_ERROR;
|
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);
|
param = line.gettoken_str(tok);
|
||||||
NOStream ostrm;
|
NOStream ostrm;
|
||||||
if (!ostrm.CreateFileForAppending(param, NStreamEncoding::ACP))
|
if (!ostrm.CreateFileForAppending(param, NStreamEncoding::ACP))
|
||||||
|
@ -1429,7 +1436,8 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
|
||||||
if (ostrm.IsUnicode()) bom = false;
|
if (ostrm.IsUnicode()) bom = false;
|
||||||
if (forceEnc) ostrm.StreamEncoding().SetCodepage(cp);
|
if (forceEnc) ostrm.StreamEncoding().SetCodepage(cp);
|
||||||
const TCHAR *const text = line.gettoken_str(++tok);
|
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);
|
ERROR_MSG(_T("!appendfile: error writing to \"%") NPRIs _T("\".\n"), param);
|
||||||
return PS_ERROR;
|
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_TEMPFILE,_T("!tempfile"),1,0,_T("symbol"),TP_ALL},
|
||||||
{TOK_P_DELFILE,_T("!delfile"),1,1,_T("[/nonfatal] file"),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_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},
|
{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