Var can now be used in sections and functions, but only with the /GLOBAL flag

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4211 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-08-06 16:04:17 +00:00
parent f5105a50b1
commit 68dc7f9f7e
4 changed files with 36 additions and 7 deletions

View file

@ -5329,10 +5329,28 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
// Added by ramon 3 jun 2003
case TOK_DEFVAR:
{
SCRIPT_MSG("VAR \"%s\"\n",line.gettoken_str(1));
int res = DeclaredUserVar(line.gettoken_str(1));
if (res != PS_OK)
return res;
int a=1;
if (!strcmpi(line.gettoken_str(1),"/GLOBAL"))
{
a++;
}
if (build_cursection)
{
if (a==1)
{
ERROR_MSG("Var: currently, only global variables can be defined.\n");
PRINTHELP();
}
}
SCRIPT_MSG("Var: \"%s\"\n",line.gettoken_str(a));
int res = DeclaredUserVar(line.gettoken_str(a));
if (res != PS_OK)
return res;
}
return PS_OK;