Old 31st January 2012, 14:38   #1
ptz
Junior Member
 
Join Date: Nov 2011
Posts: 8
Conditionally extract files

I want to have a single large installer file from which I will only extract parts, depending on the user's choice. How can I achieve this? I only know the "File" command for adding files to the installer, but it seems to have a dual action - it also extracts everything that's been added.

Thanks.
ptz is offline   Reply With Quote
Old 31st January 2012, 15:47   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You cannot conditionally extract files if you are using /r (this is what I assume you have done). You need individual File instructions and conditionally execute them using LogicLib.

Stu
Afrow UK is offline   Reply With Quote
Old 31st January 2012, 16:09   #3
ptz
Junior Member
 
Join Date: Nov 2011
Posts: 8
Let me rephrase. Suppose I have 2 files that I need to include (this happens at compile time) in my installer so that one of them is extracted (this happens at runtime) depending on user's choice. In order to have both files in my installer file I need to have
File file1
File file2
But this, to the best of my knowledge, will not only add (at compile time) file1 and file2 to the installer, but will also extract (at runtime) both of them without asking. I need to separate the compile-time and runtime events.
ptz is offline   Reply With Quote
Old 31st January 2012, 17:03   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:
${If} [user wants file 1]
File file1
${EndIf}
${If} [user wants file 2]
File file2
${EndIf}

The compiler will still bundle both files in the package, but will only extract the file (execute the File instruction) if you do not jump over it. Having multiple Sections and a Components page effectively gives you the same behaviour.

Stu
Afrow UK is offline   Reply With Quote
Old 1st February 2012, 07:52   #5
ptz
Junior Member
 
Join Date: Nov 2011
Posts: 8
Thank you, Stu. I thought I have - but clearly haven't - experiment enough to understand that the compiler will bundle both file1 and file2 with such code.
ptz is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
file

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