electron-builder nsis 运行 安装期间的其他可执行文件

electron-builder nsis run other executable during install

我正在尝试 运行 在我的应用程序安装过程中使用不同的可执行文件,但我找不到执行此操作的正确路径。该程序添加了以下 electron-builder 配置:

extraFiles:
    -   from: tools/tapinstall/${arch}/
        to: resources/tapinstall/
        filter:
            - "**/*"

安装我的应用程序后,我可以在 resources/tapinstall/ 文件夹中看到文件,因此它正在移植。现在,在我的 nsis installer.nsh 中,我从该目录向 运行 和 exe 添加了一个 ExecWait 指令,但它失败了。

作为一种绝望的措施,我认为用 $INSTDIR 作为前缀并不是正确的做法,也许路径不是 $INSTDIR 和其他东西,我发现了 3 个可能的候选者:

我添加了这个简单的代码来查看创建了哪个文件,这样我就可以找出要使用的正确宏:

!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

然后我在我的计算机上全面搜索了一个名为 customInstall 的文件...没有。我做错了什么?

!system(以及所有其他 ! 指令)在编译时在 makensis.exe 内执行。您无法在编译时访问 variables/constants,只能定义和环境变量。

!define foo "Hello"
!warning "${NSISDIR} & $%Temp% & ${foo}"

Var Bar
Section
StrCpy $Bar "World"
MessageBox mb_ok "$InstDir & $Bar"
SectionEnd