Old 15th November 2005, 13:12   #1
Axonn
Guest
 
Posts: n/a
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.
  Reply With Quote
Old 15th November 2005, 13:31   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I guess you missed this bit in the documentation.

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

-Stu
Afrow UK is offline   Reply With Quote
Old 16th November 2005, 06:19   #3
Axonn
Guest
 
Posts: n/a
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"?
  Reply With Quote
Old 16th November 2005, 06:37   #4
flyakite
Member
 
Join Date: Dec 2003
Location: Chicago
Posts: 50
Send a message via AIM to flyakite Send a message via Yahoo to flyakite
+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.
flyakite is offline   Reply With Quote
Old 16th November 2005, 07:12   #5
Axonn
Guest
 
Posts: n/a
Thank you

Yes, by now I already knew everything. Thanks for the good explanations!
  Reply With Quote
Old 16th November 2005, 12:52   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
0 just means carry on which is the same as using +1

-Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump