Archive: Am I doing this correctly???


Am I doing this correctly???
Alright, I've been experimenting with the IfFileExists instruction, and I'm hoping this is right:


;called when the install was successful
Function .onInstSuccess
CreateDirectory "$INSTDIR\baldurdashbackup"
IfFileExists "$INSTDIR\baldurdash\abazigal\abazigal.tp2" 0 abaz
ExecWait "$INSTDIR\baldurdash.exe --yes baldurdash/abazigal/abazigal.tp2"
abaz:
IfFileExists "$INSTDIR\baldurdash\balthazar\balthazar.tp2" 0 balth
ExecWait "$INSTDIR\baldurdash.exe baldurdash/balthazar/balthazar.tp2"
balth:
IfFileExists "$INSTDIR\baldurdash\bhaalspawn\bhaalspawn.tp2" 0 bhaal
ExecWait "$INSTDIR\baldurdash.exe baldurdash/bhaalspawn/bhaalspawn.tp2"
bhaal:
IfFileExists "$INSTDIR\baldurdash\romance\romance.tp2" 0 romance
ExecWait "$INSTDIR\baldurdash.exe baldurdash/romance/romance.tp2"
romance:
MessageBox MB_OK "Installation complete."
FunctionEnd


Am I using those labels correctly? So, the 0 tells it to proceed to the next instruction if the file exsits, and the internal label tells it to goto that label if it doesn't exist correct?

I looked at some examples, and some people were using it like this:


IfFileExists "$INSTDIR\blah.tmp" 0 3


What exactly does that 0 3 mean? I tried compiling my script with just numbers as labels, and it spat out some stuff about not being able to use 0-9 or - as labels. However, if I put 0 and an internal label it has no problems.

Oh yeah, it's also not executing that exe correctly for some reason. It runs it, however, the exe doesn't compile the script correctly like it's supposed to. I've tested the exe outside of the installer with the exact same command line instruction, in the exact same directory and it works fine.

Thanks for any help in advance ;)

I should have read the doc before, but i'll try to remember it ;) !
Well, 3 must mean that "jump 3 lines" ! So 0 is interpreted as a jump 0 line (continue) ! -3 is allowed too ;) !


A jump can be relative to the current location in the script. In that case use as jump parameter: +q or -q where q is the number of commands from the current command. Eg. +1 would lead to the next instruction, -1 to the previous instruction. So do not forget the sign in the jump and do for example:

IfFileExists "c:\winnt\*.*" 0 +3
MessageBox MB_OK "Yes"
Goto Exit
MessageBox MB_OK "No"
Exit:
to test if this dir exists. Notice that this is not the best thing to d when still developing a script since you will need to adapt all jumps if you add commands to the script. Use labels to jump to a fix location in the script to overcome this problem (just like you did in your script).
BTW, this is in the NSIS Docs.

Running the exe? Not compiling correctly?
Do you mean "$INSTDIR\baldurdash.exe" should be some compiler? Use a MessageBox to check the commandline before executing. Maybe something is wrong there and the compiler file cannot find the script file. Try to find out using MessageBoxes (the only way to debug the NSIS code, btw).

-Hendri.