我想使用一个常量来指定要安装的文件所在的目录,如下所示:
; -*-nsis-*-
Name "ndhtest"
OutFile "FooStartMenuTest.exe"
!define FOO_SRC c:\users\nhughes\foo
InstallDir "$PROGRAMFILES\Initech\"
Page instfiles
Section
SetOutPath $INSTDIR
File "$FOO_SRC\foo.bat" ;; <-- line 15 here
CreateDirectory $SMPROGRAMS\Initech
CreateShortCut $SMPROGRAMS\Initech\Foo.lnk $INSTDIR\foo.bat "" \
"$FOO_SRC\foo_logo.ico" ;; <-- line 18 here
SectionEnd
这会导致以下错误消息(在emacs中,使用nsis模式):
Processing script file: "c:/users/nhughes/STARTM~1.NSI"
Name: "ndhtest"
OutFile: "FooStartMenuTest.exe"
XPStyle: on
!define: "FOO_SRC"="c:\users\nhughes\foo"
InstallDir: "$PROGRAMFILES\Initech\"
Page: instfiles
Section: ""
SetOutPath: "$INSTDIR"
File: "$FOO_SRC\foo.bat" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "c:/users/nhughes/STARTM~1.NSI" on line 15 -- aborting creation process
如果我将第15行替换为
File c:\users\nhughes\foo\foo.bat
第18行包含
"c:\users\nhughes\foo\foo_logo.ico"
那么它工作得很好。
发布于 2011-08-10 17:41:13
请尝试使用${FOO_SRC}
。
https://stackoverflow.com/questions/7015079
复制相似问题