I'm trying to run a different executable during install of my app but I cannot find the right path to do it. The program is added with the following electron-builder
config:
extraFiles:
- from: tools/tapinstall/${arch}/
to: resources/tapinstall/
filter:
- "**/*"
After installing my app I can see the files in the resources/tapinstall/
folder so it's being ported. Now, in my nsis
installer.nsh
I added an ExecWait
directive to run an exe
from that directory but it fails.
As a desperate measure I figured that prefixing everything with $INSTDIR
was not the right move, maybe the path is not $INSTDIR
and something else and I found 3 possible candidates:
$INSTDIR
$APPDATA
$BUILD_RESOURCES_DIR
I added this simple code to see which file gets created so I can figure out the right macro to use:
!macro customHeader
RequestExecutionLevel admin
!macroend
!macro customInstall
!system "echo 'as' > $INSTDIR/customInstall"
!system "echo 'bs' > $APPDATA/customInstall"
!system "echo 'cs' > $BUILD_RESOURCES_DIR/customInstall"
${ifNot} ${isUpdated}
!system "echo 'a' > $INSTDIR/customInstall"
!system "echo 'b' > $APPDATA/customInstall"
!system "echo 'c' > $BUILD_RESOURCES_DIR/customInstall"
${endIf}
!macroend
I then did a full search on my computer for a file called customInstall
...nothing. What am I doing wrong?
!system
(and all other !
instructions) are executed at compile-time inside makensis.exe. You cannot access variables/constants at compile time, only defines and environment variables.
!define foo "Hello"
!warning "${NSISDIR} & $%Temp% & ${foo}"
Var Bar
Section
StrCpy $Bar "World"
MessageBox mb_ok "$InstDir & $Bar"
SectionEnd