TeeWeTee
15th February 2013 15:27 UTC
Basic goto offset question
Sorry for this newbie question however this is quite important stuff as you can imagine ;-)
Normally i thought i understand how it works e.g.:
StrCmp "" "" +2 0
DetailPrint "Line 1 ..."
DetailPrint "Line 2 ..."
DetailPrint "Line 3..."
The output is:
Line 2...
Line 3 ...
-> It jumps to the 2nd instruction, however in the following case it is not:
StrCmp "" "" +5 0
SetOutPath "\SomeUnimportantPath"
SetOverwrite on
File "someUnImportantFile.txt"
IfErrors ErrorWrite ; jumps to ErrorWrite label
DetailPrint "Should be printed out"
-> However the last line is not printed even though its the +5 instruction. If I use +4 everything works however i don't get it then... What am i missing here?
Anders
15th February 2013 20:43 UTC
SetOverwrite is probably not a runtime instruction.
Save yourself some trouble and use labels or even better, logiclib.nsh...
MSG
16th February 2013 12:35 UTC
Hah, very nice catch!
T.Slappy
18th February 2013 06:45 UTC
It is well documented in manual - section 4.4 Relative Jumps and 4.9 Instructions:
An instruction is every command that is executed at run-time, when the installer is running. MessageBox, Goto, GetDLLVersion, FileRead, SetShellVarContext are all instructions. AddSize, Section, SectionGroup, SectionEnd, SetOverwrite (and everything under 4.8.2 Compiler Flags), Name, SetFont, LangString, are not instructions because they are executed at compile time.
TeeWeTee
18th February 2013 10:52 UTC
Thanks for the info and the hint to the documentation.
In my case you are right
SetOverwrite
doesn't count since it is not a runtime instruction. Now I better recheck the rest of my code :D