RoMZERO
28th October 2004 19:45 UTC
goto bug ?
Hi, before, sorry my english :p
i have a problem with IfFileExist istruction
this is the script
Function .oninit
ReadINIStr $R0 "$EXEDIR\config.ini" "GCF" "HL2"
IfFileExists "$EXEDIR\$R0.7z" +3 (in the test the file exist)
!insertmacro UnSelectSection "${SecHL2}"
SectionSetText ${SecHL2} ""
ReadINIStr $R0 "$EXEDIR\config.ini" "GCF" "DOD"
etc. etc. etc.
FunctionEnd
+3 in the "IfFileExists "$EXEDIR\$R0.7z" +3" don't work, don't jump at "ReadINIStr $R0 "$EXEDIR\config.ini" "GCF" "DOD"" string
why ?
tnx for help
kichik
28th October 2004 19:48 UTC
Macros can contain more than one command. When jumping over macros, use labels.
RoMZERO
28th October 2004 20:20 UTC
tnx :)
razor_x
1st November 2004 16:44 UTC
I think we can also use LogicLib.nsh here cant we?
${If} ${FileExists} "${__FILE__}"
ReadINIStr $R0 "$EXEDIR\config.ini" "GCF" "DOD"
${EndIf}
kichik
2nd November 2004 17:41 UTC
Of course, but it uses labels too ;)
razor_x
3rd November 2004 19:02 UTC
yep but labels are often messy and sometimes require other commands like goto etc ...and many lines of code can be reduced with logiclib...I love the damn thing :)
Comm@nder21
4th November 2004 10:58 UTC
many lines of code???
did u ever look into the logic lib file? there are at least twice the lines of code, than you would have if you wrote your own specific optimized code.
that's because the logic lib is for universal usage.
razor_x
4th November 2004 13:55 UTC
hello?
I was just refering to length of the script..not all the associated libs etc...I have made some scripts alot shorter and cleaner using it was all i meant.Spefically when many strcmp statements are made etc..
Afrow UK
4th November 2004 18:24 UTC
Comm@nder21 was only pointing out that LogicLib may shorten your NSIS script, but would lengthen run-time execution (unnoticeably of course) because it adds a lot of code into the script on compile in order for it to function correctly.
-Stu
kichik
4th November 2004 18:32 UTC
The LogicLib header file might contain lots of lines of code, but almost all of them are preprocessor lines. The end result is very similar to what you'd get if you write the code on your own. For example, ${If} $0 == $0 translates into one simple StrCmp.