Skip to content
⌘ NSIS Forum Archive

extraction on quit ???

3 posts

theblazingangel#

extraction on quit ???

i've got another problem. the following script (stripped down) creates C:\temp\test.txt (0 byte file) when it's not supposed to (prerequisite check failed)

note #1: the file is not actually 0 bytes, the one i'm testing with is 21 bytes!
note #2: it only happens after pressing the 'ok' button on the error message
note #3: it only happens with the finish page reference present

i'm using nsis v2.25

;--------------------------------
; Modern interface settings
    !include "MUI.nsh"
;--------------------------------
; General
    Name 'test'
    InstallDir "C:\temp\"
    OutFile "test.exe"
;--------------------------------
; Pages
    !insertmacro MUI_PAGE_DIRECTORY
      !define MUI_PAGE_CUSTOMFUNCTION_SHOW 'InstFunc_CheckPreReq'
    !insertmacro MUI_PAGE_INSTFILES
    !insertmacro MUI_PAGE_FINISH
;--------------------------------
; Languages
 
    !insertmacro MUI_LANGUAGE "English"
;--------------------------------
; Installation
    Section 'Installation'
    SetOutPath $INSTDIR
    File test.txt
    SectionEnd
;--------------------------------
; Installer/Uninstaller Functions
    Function InstFunc_CheckPreReq
    IfFileExists $INSTDIR\test_2.txt +3 0
        MessageBox MB_OK|MB_ICONSTOP "Error: Prerequisite check failed! You must install ' test_2.txt ' first!"
        Quit
    FunctionEnd 
theblazingangel#
nevermind, fixed it by using MUI_PAGE_CUSTOMFUNCTION_PRE instead of MUI_PAGE_CUSTOMFUNCTION_SHOW

but shouldn't the fact it does this be considered a bug?
kichik#
Talk about some mad usage of Quit... I added a check for Quit so the sections won't start executing if Quit was called in the show function.