Prev Previous Post   Next Post Next
Old 27th October 2006, 19:13   #1
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Updating Space required after setting $INSTDIR

In my installer I am copying a 100MB file from a CD to the installation directory using FileCopy. The installer first does MUI_PAGE_COMPONENTS, then asks where to find the file from the CD (called arc.sar), and after that gets to the MUI_PAGE_DIRECTORY. What I want the installer to do is first get $INSTDIR on the DIRECTORY page, then check if $INSTDIR\arc.sar exists, and then substract arc.sar's size from the required free space, updating the Space Required: label on that same page, the DIRECTORY page.

Some parts of the script:
code:

!insertmacro MUI_PAGE_COMPONENTS
;Custom page: asks where to find arc.sar
Page custom GetSarLocation CheckSarLocation
;Find arc.sar in $INSTDIR and substract filesize
!define MUI_PAGE_CUSTOMFUNCTION_PRE CheckExistingSar
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

Function CheckExistingSar
IfFileExists "$INSTDIR\arc.sar" 0 NoExistingSar
Push "$INSTDIR\arc.sar"
Call FileSizeNew
Pop $EXISTING_SAR_SIZE
IntOp $EXISTING_SAR_SIZE $EXISTING_SAR_SIZE % -1000
SectionGetSize CommonInstall $2
IntOp $2 $2 - EXISTING_SAR_SIZE
SectionSetSize CommonInstall $2

NoExistingSar:
FunctionEnd



As you can see I've tried to use PAGE_CUSTOMFUNCTION_PRE on PAGE_DIRECTORY, and indeed the function CheckExistingSar updates the size of the CommonInstall section succesfully if it can find arc.sar. Only the 'Space required' value does not change, and the CheckExistingSar function is in fact called only once. Entering a different install path does not call the function again.

I've read some hints about using FindWindow etc commands to manually influence the label, but I have no clue how to go about this. Any help would be greatly appreciated.

Last edited by MSG; 27th October 2006 at 19:39.
MSG is offline   Reply With Quote
 
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