Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   IfFileExists works like... how? (http://forums.winamp.com/showthread.php?t=231074)

Axonn 15th November 2005 13:12

IfFileExists works like... how?
 
Hi again. I got a question related to how the NSIS script works which I haven't really sorted out yet with the use of documentation only.

In the very short time since I've been aquainted to NSIS (3 days ago) I saw in the documentation things like this:

IfFileExists $WINDIR\notepad.exe 0 +2
MessageBox MB_OK "notepad is installed"

What's that +2? What's it supposed to mean? And the 0? The 0 I guess means go to the next line.

Afrow UK 15th November 2005 13:31

I guess you missed this bit in the documentation.

http://nsis.sourceforge.net/Docs/Chapter4.html#4.4

-Stu

Axonn 16th November 2005 06:19

But the 0?
 
Yeah, I suspected that. But still, according to the documentation, 1 should mean jump to the next instruction while 2 should mean skip the next instruction. Then what does 0 mean? I assume "do nothing" / "continue execution as if nothing happened"?

flyakite 16th November 2005 06:37

+2 means jump two instructions. Say you have the following:

IfFileExists "FILE.exe" +1 +2
Exists
DoesNOTExist


If the file exists, it jumps 1 instruction, meaning, it jumps to "Exists". Technically 0 and "" do the same thing. It essentiall tells the installer to just continue. +1 means jump 1 instruction, which really is just continuing.

+2 goes two lines of course. So it ends up at DoesNOTExist.

+# doesn't mean to skip the next # instructions. It means to jump to that instruction. +2 goes two instructions, skipping 1.


If relative jumps confuse you you could always use labels as alternative.

Axonn 16th November 2005 07:12

Thank you
 
Yes, by now I already knew everything. Thanks for the good explanations!

Afrow UK 16th November 2005 12:52

0 just means carry on which is the same as using +1

-Stu


All times are GMT. The time now is 17:56.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.