我正在将 nsis 用于 Web 应用程序的安装程序。在向导的一页中,我希望用户选择三个复选框之一:每个复选框都必须以不同的方式设置两个变量。
这是我要运行的代码:
!define DATA_ONE data_one.zip !define DATA_TWO data_two.zip !define DATA_THREE data_three.zip
函数 myfunc ... ${NSD_GetState} $RadioOne $1 ${NSD_GetState} $RadioTwo $2 ${NSD_GetState} $RadioThree $3
; The two variables i want to set
Var /GLOBAL CUSTOMER_DATA ; this should be a File (?)
Var /GLOBAL LENGTH_POS ; this is a string
StrCpy $CUSTOMER_DATA ${DATA_ONE} ; default value
StrCpy $LENGTH_POS ""
${If} $1 == ${BST_CHECKED}
StrCpy $CUSTOMER_DATA ${DATA_ONE}
StrCpy $LENGTH_POS "3"
${endif}
${If} $2 == ${BST_CHECKED}
StrCpy $CUSTOMER_DATA ${DATA_TWO}
StrCpy $LENGTH_POS ""
${endif}
${If} $3 == ${BST_CHECKED}
StrCpy $CUSTOMER_DATA ${DATA_THREE}
StrCpy $LENGTH_POS ""
${endif}
; here the line i've got the error
File ${BUILD_DIR}/$CUSTOMER_DATA
...
功能结束
当我尝试运行它时,我得到了:
File: "./$CUSTOMER_DATA" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
我认为错误是因为我正在构建的文件不是在编译时定义的,而是在运行时定义的。这是对的吗 ?我应该使用宏吗?解决这个问题的更优雅的方法是什么?