Old 21st September 2017, 13:39   #1
Pawel
Moderator
 
Pawel's Avatar
 
Join Date: Aug 2004
Location: Poland
Posts: 500
Send a message via ICQ to Pawel
Section Size problem

NSIS displays approximate size of sections on Directory Page...
http://www.meggamusic.co.uk/shup/1505997197/ddd.png

It works fine, but not in the following case:

PHP Code:
Section "Section" SEC_IDX
   
${If} ${RunningX64}
      ; 
64 bit code
      SetOutPath 
"$INSTDIR\MY_APP"
      
File /"C:\MY_APP\x64\*.*"
   
${Else}
      ; 
32 bit code
      SetOutPath 
"$INSTDIR\MY_APP"
      
File /"C:\MY_APP\x86\*.*"
   
${EndIf}
SectionEnd 
Above example code will install 64 bit version of my app on 64 bit machine and 32 bit version of my app on 32 bit machine...
The problem is that NSIS will display "double" size of this section (there are 2 "File" commands, so NSIS will add size of files in both commands).

What should I do in that case? I would like to see real size of installed files...

Should I use SectionSetSize command and manually change it? Or there is some other smart solution?

-Pawel
Pawel is offline   Reply With Quote
Old 21st September 2017, 17:12   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,611
Use two sections. Hide (empty name) and uncheck the one that does not match the system type in .onInit.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 21st September 2017, 18:58   #3
Pawel
Moderator
 
Pawel's Avatar
 
Join Date: Aug 2004
Location: Poland
Posts: 500
Send a message via ICQ to Pawel
That is the solution... Thanks!
What if I can not use 2 sections (to much work)?
Pawel is offline   Reply With Quote
Old 23rd October 2017, 15:09   #4
sfx09
Junior Member
 
Join Date: Jul 2017
Posts: 18
Quote:
Originally Posted by Pawel View Post
That is the solution... Thanks!
What if I can not use 2 sections (to much work)?
SectionSetSize maybe help?
sfx09 is offline   Reply With Quote
Old 23rd October 2017, 15:17   #5
Pawel
Moderator
 
Pawel's Avatar
 
Join Date: Aug 2004
Location: Poland
Posts: 500
Send a message via ICQ to Pawel
@Anders
Using two sections for a component is a good solution, however not in my installer. I had to use a bit more compilcated solution.

@sfx09
Yes, thanks for your tip.
SectionSetSize is helpful but it was not so easy...


I already done this. My solution was to:
1. Get size of all needed components and save it to file (I use special app to compile my installer)
2. Add this file to installer
3. Unpack file during installation (into pluginsdir), read needed size
4. Set proper sections to proper size using SectionSetSize instruction

It works
-Pawel

Last edited by Pawel; 24th October 2017 at 18:02.
Pawel is offline   Reply With Quote
Old 23rd October 2017, 15:37   #6
sfx09
Junior Member
 
Join Date: Jul 2017
Posts: 18
Quote:
Originally Posted by Pawel View Post
I already done this. My solution was to:
1. Get size of all needed components and save it to file (I use special app to compile my installer)
2. Add this file to installer
3. Unpack file during installation (into pluginsdir), read needed size
4. Set proper sections to proper size using SectionSetSize instruction
I had a similar problem. My nsis-script generate from second application for creating different installers for different programs.
I get size of all components using second app. Then I put it in script. And show all size in own nsDialog-step (not using SectionSetSize). =) Maybe it's right for you.
sfx09 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