%1 in !finalize command can be specified multiple times
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7091 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
046353f7c5
commit
36cf6ec2b3
2 changed files with 14 additions and 10 deletions
|
@ -20,6 +20,8 @@ ANSI targets are deprecated, consider moving to Unicode.
|
||||||
|
|
||||||
\b Allow quoted library path in System::Call (\W{http://sf.net/p/nsis/bugs/546}{bug #546})
|
\b Allow quoted library path in System::Call (\W{http://sf.net/p/nsis/bugs/546}{bug #546})
|
||||||
|
|
||||||
|
\b %1 in !finalize command can be specified multiple times
|
||||||
|
|
||||||
|
|
||||||
\S2{} Translations
|
\S2{} Translations
|
||||||
|
|
||||||
|
|
|
@ -4019,22 +4019,24 @@ int CEXEBuild::run_postbuild_cmds(const postbuild_cmd *cmds, const TCHAR *templa
|
||||||
{
|
{
|
||||||
for (const postbuild_cmd *cmd = cmds; cmd; cmd = cmd->next)
|
for (const postbuild_cmd *cmd = cmds; cmd; cmd = cmd->next)
|
||||||
{
|
{
|
||||||
const TCHAR *cmdstr = cmd->cmd;
|
const TCHAR *cmdstr = cmd->cmd, *searchstart = cmdstr;
|
||||||
TCHAR *arg = _tcsstr(const_cast<TCHAR*>(cmdstr), _T("%1")), *cmdstrbuf = NULL;
|
TCHAR *arg, *cmdstrbuf = NULL, *tmpbuf;
|
||||||
if (arg) // If found, replace %1 with templatearg_pc1
|
for (; arg = _tcsstr(const_cast<TCHAR*>(searchstart), _T("%1"));) // While found, replace %1 with templatearg_pc1
|
||||||
{
|
{
|
||||||
const size_t cchtpc1 = _tcslen(templatearg_pc1);
|
const size_t cchtpc1 = _tcslen(templatearg_pc1);
|
||||||
cmdstrbuf = (TCHAR*) malloc((_tcslen(cmdstr) + cchtpc1 + 1) * sizeof(TCHAR));
|
tmpbuf = (TCHAR*) malloc((_tcslen(cmdstr) + cchtpc1 + !0) * sizeof(TCHAR));
|
||||||
if (!cmdstrbuf)
|
if (!tmpbuf)
|
||||||
{
|
{
|
||||||
ERROR_MSG(_T("Error: Can't allocate memory for %") NPRIs _T(" command\n"), commandname);
|
ERROR_MSG(_T("Error: Can't allocate memory for %") NPRIs _T(" command\n"), commandname);
|
||||||
return PS_ERROR;
|
return PS_ERROR;
|
||||||
}
|
}
|
||||||
arg -= ((UINT_PTR)cmdstr)/sizeof(TCHAR), arg += ((UINT_PTR)cmdstrbuf)/sizeof(TCHAR);
|
arg -= ((UINT_PTR)cmdstr)/sizeof(TCHAR), arg += ((UINT_PTR)tmpbuf)/sizeof(TCHAR);
|
||||||
_tcscpy(cmdstrbuf, cmdstr), cmdstr = cmdstrbuf;
|
_tcscpy(tmpbuf, cmdstr);
|
||||||
memmove(arg+cchtpc1, arg+2, (_tcslen(arg+2)+1)*sizeof(TCHAR));
|
free(cmdstrbuf);
|
||||||
memmove(arg, templatearg_pc1, cchtpc1*sizeof(TCHAR));
|
memmove(arg + cchtpc1, arg + 2, (_tcslen(arg + 2) + !0) * sizeof(TCHAR));
|
||||||
//BUGBUG: Should we call PathConvertWinToPosix on templatearg_pc1?
|
memmove(arg, templatearg_pc1, cchtpc1 * sizeof(TCHAR));
|
||||||
|
// BUGBUG: Should we call PathConvertWinToPosix on templatearg_pc1?
|
||||||
|
cmdstr = cmdstrbuf = tmpbuf, searchstart = arg + cchtpc1;
|
||||||
}
|
}
|
||||||
SCRIPT_MSG(_T("\n%") NPRIs _T(" command: %") NPRIs _T("\n"), commandname, cmdstr);
|
SCRIPT_MSG(_T("\n%") NPRIs _T(" command: %") NPRIs _T("\n"), commandname, cmdstr);
|
||||||
int ret = sane_system(cmdstr);
|
int ret = sane_system(cmdstr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue