nsis文件文件夹参数化目录
我想做一个功能,添加一些文件到一些文件夹,因为我需要添加更多的文件 以下是我的函数代码:nsis文件文件夹参数化目录,nsis,Nsis,我想做一个功能,添加一些文件到一些文件夹,因为我需要添加更多的文件 以下是我的函数代码: Function "addElement" DetailPrint $0 CreateDirectory $INSTDIR\data\Element\$0 SetOutPath $INSTDIR\data\Element\$0 File /r "${binFolder}\data\Element\$0\*.*" FunctionEnd 这里我称之为: strcpy $0
Function "addElement"
DetailPrint $0
CreateDirectory $INSTDIR\data\Element\$0
SetOutPath $INSTDIR\data\Element\$0
File /r "${binFolder}\data\Element\$0\*.*"
FunctionEnd
这里我称之为:
strcpy $0 "Element_1"
call "addElement"
strcpy $0 "Element_2"
call "addElement"
strcpy $0 "Element_3"
call "addElement"
nsis给出了以下错误:
在
File/r.行中,
gives->未找到任何文件。$0
是一个变量,变量在运行时使用,File
指令需要在编译时知道文件名
用宏替换函数:
!macro addElement fname
DetailPrint "${fname}"
CreateDirectory "$INSTDIR\data\Element\${fname}"
SetOutPath "$INSTDIR\data\Element\${fname}"
File /r "${binFolder}\data\Element\${fname}\*.*"
!macroend
...
Section
!insertmacro addElement foo
!insertmacro addElement bar
!insertmacro addElement baz