Inno-setup:找不到功能?
我正在尝试使用 Pascal 脚本构建一个脚本来返回文件夹的名称(但我想稍后使用相同的函数来获得更广泛的结果)。 我的脚本在这里:
;This is a test script
#define MySourceDir "D:\Temp\InnoTestSrc"
#define MyDestDir "D:\Temp\InnoTest"
[Setup]
DefaultDirName={#MyDestDir}
DisableDirPage=no
AppName="MyTestApp"
AppVersion=1
[Code]
function GetMyConstant(Param: String): String;
var
strConst: string;
begin
strConst := '{#' + Param + '}';
MsgBox(strConst, mbInformation, MB_OK);
Result := expandconstant(strConst);
end;
function GetDataDir(Param: String): String;
begin
{ Return the selected DataDir }
Result := 'DummyString';
end;
[Files]
Source: {#MySourceDir}\TestFile.pdf; DestDir: {code: GetDataDir}
但是,当我尝试编译它时,我收到
编译错误! 线路:29 错误:找不到所需的函数或过程“GetDataDir”。
我试图理解为什么编译器找不到该函数,但我不明白。 任何对我的(可能是明显的)错误的帮助将不胜感激
I am trying to build a script using Pascal scripting to return the name of a folder (but I want later to use the same function for wider results).
My scrip is here:
;This is a test script
#define MySourceDir "D:\Temp\InnoTestSrc"
#define MyDestDir "D:\Temp\InnoTest"
[Setup]
DefaultDirName={#MyDestDir}
DisableDirPage=no
AppName="MyTestApp"
AppVersion=1
[Code]
function GetMyConstant(Param: String): String;
var
strConst: string;
begin
strConst := '{#' + Param + '}';
MsgBox(strConst, mbInformation, MB_OK);
Result := expandconstant(strConst);
end;
function GetDataDir(Param: String): String;
begin
{ Return the selected DataDir }
Result := 'DummyString';
end;
[Files]
Source: {#MySourceDir}\TestFile.pdf; DestDir: {code: GetDataDir}
However, when I try to compile it, I get
Compile Error!
Line: 29
Error: Required function or procedure ' GetDataDir' not found.
I am trying to understand why the compiler cannot find the function, but I do not understand.
Any help to my (probably obvious) error would be highly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你这样做的话有效吗
?我认为确实如此。事实上,您应该听编译器的意见,它说没有名为
GetDataDir
的函数。当然没有!您的函数名为GetDataDir
!Does it work if you do
instead? I think it does. Indeed, you should listen to the compiler, which says that there is no function called
<space>GetDataDir
. Of course there is not! Your function is calledGetDataDir
!