applied patch #1372048 - added /NONFATAL switch to !include statement

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4437 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-12-03 09:45:17 +00:00
parent 90a7765cd6
commit b1be974447
4 changed files with 38 additions and 6 deletions

View file

@ -1,3 +1,6 @@
!ifndef file_is_included
!define file_is_included
Name preprocessor
OutFile preprocessor.exe
@ -48,5 +51,16 @@ d\
i\
f
# this should just give a warning, not an error
!include /NONFATAL file_that_doesnt_exist.nsh
# this should include this file just one time.
!include preprocessor.nsi
Section
SectionEnd
!else
# this should just give a warning, not an error
!include /NONFATAL another_file_that_doesnt_exist.nsh
!endif

View file

@ -2745,7 +2745,20 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
return PS_OK;
case TOK_P_INCLUDE:
{
bool required = true;
char *f = line.gettoken_str(1);
if(!stricmp(f,"/nonfatal")) {
if (line.getnumtokens()!=3)
PRINTHELP();
f = line.gettoken_str(2);
required = false;
} else if (line.getnumtokens()!=2) {
PRINTHELP();
}
#ifdef _WIN32
char *fc = f;
#else
@ -2820,8 +2833,12 @@ int CEXEBuild::doCommand(int which_token, LineParser &line)
// nothing found
if (!included)
{
ERROR_MSG("!include: could not find: \"%s\"\n",f);
return PS_ERROR;
if(required) {
ERROR_MSG("!include: could not find: \"%s\"\n",f);
return PS_ERROR;
} else {
warning_fl("!include: could not find: \"%s\"",f);
}
}
}
return PS_OK;

View file

@ -222,7 +222,7 @@ static tokenType tokenlist[TOK__LAST] =
{TOK_P_SYSTEMEXEC,"!system",1,2,"command [<|>|<>|=) retval]",TP_ALL},
{TOK_P_EXECUTE,"!execute",1,0,"command",TP_ALL},
{TOK_P_ADDINCLUDEDIR,"!AddIncludeDir",1,0,"dir",TP_ALL},
{TOK_P_INCLUDE,"!include",1,0,"filename.nsi",TP_ALL},
{TOK_P_INCLUDE,"!include",1,1,"[/NONFATAL] filename.nsh",TP_ALL},
{TOK_P_CD,"!cd",1,0,"absolute_or_relative_new_directory",TP_ALL},
{TOK_P_IFDEF,"!ifdef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]",TP_ALL},
{TOK_P_IFNDEF,"!ifndef",1,-1,"symbol [| symbol2 [& symbol3 [...]]]",TP_ALL},