我想使用常量指定要安装的文件所在的目录,如下所示:
; -*-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-mode):
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"
然后它运作正常。
答案 0 :(得分:6)
请尝试使用${FOO_SRC}
。