Old 28th April 2017, 13:57   #1
ThirtySomething
Junior Member
 
Join Date: Apr 2017
Posts: 2
NSIS 3 Page Directory Required Size

Hello @all,

I'm using NSIS 3.01 and my installer works fine except the required space. I've googled this topic and search also this forum here, but was not able to solve the problem. Let's go more into details:
  • I've splitted the complete code into several files
  • The main file includes all other files
  • The anonymous main section will call other functions in dependecy a fresh install is required or an update has to be performed
  • The install function again is splitted into several sub-functions to perform grouped operations like creation of directories, copying of files, adding shortcuts and so on
  • For the directory selection page also a separate file exists with pre- and post-functions

As mentioned above, the search with google and inside this forum pops up some potential solutions:
  • SectionGetSize/SectionSetSize - The anonymous default section was provided with a name and an ID. I've tried to read the size and set it to the directory selection page without any succes. The size was always 0.
  • GetSize - While creating the uninstaller, the usage of GetSize works perfect. But this information is not available while asking the user for the installation directory because this step is performed after the user request.
  • AddSize - This function works perfect, but the problem is the same like on GetSize - I don't know the size before installation.
  • .onVerifyInstDir - This function looks also very promising, but the default installation dir is presetted and the function never executed.
  • .onInit - The manual setting of the size works like a charme, but the problem is the same like on GetSize - the size is unknow at this step.

As far as I understood the documentation, the filesize should be added automagically to the section by the usage of FILE. But I've found no way to get this information and to set it for the "Page directory" where the user is asked for the installation path.

My last idea was to do first a complete install into a temporary directory, claim the size and then move it to the user selected destination. But then... I thought by myself that I've missed something.

Can anyone please push me to right direction? The major scripts are attached.
Attached Files
File Type: nsi Xactools-Installer.nsi (1.3 KB, 23 views)
File Type: nsi Process-Install.nsi (9.9 KB, 21 views)
File Type: nsi PageDirectory.nsi (985 Bytes, 25 views)
ThirtySomething is offline   Reply With Quote
Old 28th April 2017, 14:23   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,529
SectionGet/SetSize takes a section id define, not a variable! The documentation has a example.

You normally don't have to do anything to calculate the size, just put the File instructions in sections (not functions) and everything should be calculated automatically.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd May 2017, 07:26   #3
ThirtySomething
Junior Member
 
Join Date: Apr 2017
Posts: 2
Now it works

Hello Anders,

thanks to your hints I take a review on the installer files and created a single one. Now I'm using only functions if necessary. The FILE command is used in the install section. The SectionGetSize and SectionSetSize commands work now as expected. I didn't realize that using functions will break the "count of installsize" mechanism of the FILE command.

Regards

ThirtySomething
Attached Files
File Type: nsi Xactools-Installer.nsi (19.2 KB, 20 views)
ThirtySomething 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