Search code examples
windowselectronwindows-installernsiselectron-builder

[electron-builder-nsis How Can I Use If-Else To Control MUI_PAGE_DIRECTORY?


First, Forgive me for my poor English~ Hello, I need finish this question: If user installed my application, update to application, I want to the install program no show the MUI_PAGE_DIRECTORY, if people never installed, can show MUI_PAGE_DIRECTORY. But Found out I couldn't do it when I write install.nsh. such as

// I want this write
${if} $userInstallPath != ""
   //
${else}
    !insertmacro MUI_PAGE_DIRECTORY
${endif}

But that's not true


Solution

  • To skip a page, call Abort in the page pre callback. I have no idea how you do this in Electron builder but in normal NSIS you do this:

    !define MUI_PAGE_CUSTOMFUNCTION_PRE dirskip
    !insertmacro MUI_PAGE_DIRECTORY
    ... 
    
    Function dirskip
    ${If} $userInstallPath != ""
       Abort
    ${EndIf}
    FunctionEnd