Skip to content
⌘ NSIS Forum Archive

Section Size problem

6 posts

Pawel#

Section Size problem

NSIS displays approximate size of sections on Directory Page...


It works fine, but not in the following case:

Section "Section" SEC_IDX
   ${If} ${RunningX64}
      ; 64 bit code
      SetOutPath "$INSTDIR\MY_APP"
      File /r "C:\MY_APP\x64\*.*"
   ${Else}
      ; 32 bit code
      SetOutPath "$INSTDIR\MY_APP"
      File /r "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
Anders#
Use two sections. Hide (empty name) and uncheck the one that does not match the system type in .onInit.
sfx09#
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?
Pawel#edited
@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
sfx09#
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.