我正在尝试在我的应用安装过程中运行其他可执行文件,但找不到正确的路径来执行此操作。该程序添加有以下electron-builder
配置:
extraFiles:
- from: tools/tapinstall/${arch}/
to: resources/tapinstall/
filter:
- "**/*"
安装我的应用程序后,我可以在resources/tapinstall/
文件夹中看到文件,因此正在移植。现在,在我的nsis
installer.nsh
中添加了ExecWait
指令以从该目录运行exe
,但失败。
作为一种绝望的措施,我认为在所有内容前都加$INSTDIR
是不正确的举动,也许路径不是$INSTDIR
等,我发现了3种可能的候选方法:
$INSTDIR
$APPDATA
$BUILD_RESOURCES_DIR
我添加了这个简单的代码来查看创建了哪个文件,因此我可以找出要使用的正确宏:
!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内的编译时执行。您不能在编译时访问变量/常量,只能定义和环境变量。
!define foo "Hello"
!warning "${NSISDIR} & $%Temp% & ${foo}"
Var Bar
Section
StrCpy $Bar "World"
MessageBox mb_ok "$InstDir & $Bar"
SectionEnd