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:
parent
90a7765cd6
commit
b1be974447
4 changed files with 38 additions and 6 deletions
|
@ -6,14 +6,15 @@ These commands are similar to the C preprocessor in terms of purpose and functio
|
|||
|
||||
\S1{include} !include
|
||||
|
||||
\c file
|
||||
\c [/NONFATAL] file
|
||||
|
||||
This command will include 'file' as if it was part of the original script. Note that if a file is included in another directory, the current directory is still where the script was compiled from (not where the included file resides). If the compiler can't find the file it will look for it in every include directory. See \R{addincludedir}{!addincludedir} for more information.
|
||||
This command will include 'file' as if it was part of the original script. Note that if a file is included in another directory, the current directory is still where the script was compiled from (not where the included file resides). If the compiler can't find the file it will look for it in every include directory. See \R{addincludedir}{!addincludedir} for more information. If the /nonfatal switch is used and no files are found, a warning will be issued instead of an error.
|
||||
|
||||
\c !include WinMessages.nsh
|
||||
\c !include Library.nsh
|
||||
\c !include MyConfig.nsh
|
||||
\c !include C:\MyConfig.nsi
|
||||
\c !include ..\MyConfig.nsh
|
||||
\c !include /NONFATAL file_that_may_exist_or_not.nsh
|
||||
|
||||
\S1{addincludedir} !addincludedir
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -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},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue