0
votes

In electron-builder, I've added the below script inside build/installer.nsh to customize the nsis installer but the commands are executed during packaging process, not during installation of the installer.

!macro customHeader
  !system "echo 'customHeader' > ${BUILD_RESOURCES_DIR}\customHeader"
!macroend

!macro preInit
  !system "echo ${BUILD_RESOURCES_DIR} C:\resourcedirpath"
  !system "echo 'preInit' > ${BUILD_RESOURCES_DIR}\preInit"
!macroend

!macro customInit
  !system "echo 'customInit' > ${BUILD_RESOURCES_DIR}\customInit"
!macroend

!macro customInstall
  !system "echo 'customInstall' > ${BUILD_RESOURCES_DIR}\customInstall"
!macroend

!macro customUnInstall
  !system "echo 'customUnInstall' > ${BUILD_RESOURCES_DIR}\customUnInstall"
!macroend

Any help appreciated.

2

2 Answers

0
votes

!system seems run at the packaging process. I used the following script to achieve the goal.

    FileOpen $9 "C:\path" a
    FileWrite $9 $EXEPATH
    FileClose $9
0
votes

Use Exec insted of !system. I was also facing the same issue