Inno Setup - #define指令 - 如何使用以前定义的变量?

时间:2011-10-29 13:28:02

标签: inno-setup

我正在使用Inno Setup版本5.4.2。

我想定义要复制的文件的路径([Files]部分中的Source:参数作为两部分,一个基本路径和子目录名称,我用于特殊文件(如.dll)。 我尝试过以下方法:

#define MyAppSetupDir "D:\MyApp\setup"
#define MyAppSetupQtDLLs {#MyAppSetupDir}"\DLLs"
[Files]
Source: {#MyAppSetupDir}\MyApp.exe; DestDir: {app}; Flags: ignoreversion
Source: {#MyAppSetupDLLs}\mstext35.dll; DestDir: {app}; Flags: ignoreversion

但是我收到以下编译错误

[ISPP] Expression expected but opening brace ("{") found.

我还尝试将大括号括在“”中,如

#define MyAppSetupQtDLLs "{#MyAppSetupDir}\DLLs"

但是这次我得到了

Error: Source file "D:\MyApp\setup\{#MyAppSetupDir}\DLLs\mstext35.dll" does not exist.

因此,ISSP正确地替换了MyAppSetupDir变量,但是再次放入简单文本,就好像它不能识别该指令一样。

我到处搜索过,我已经找到discussion关于使用{commonappdata}的问题,但我无法在文档和KB中找到如何执行此操作。 我真的很感激一些提示,因为它看起来很接近,但找不到合适的解决方案..

1 个答案:

答案 0 :(得分:64)

#define MyAppSetupDir "D:\MyApp\setup"
#define MyAppSetupQtDLLs MyAppSetupDir + "\DLLs"
相关问题