【发布时间】:2017-05-24 22:49:30
【问题描述】:
我已为要作为更新的程序创建文件。
我想在安装前先检查一下程序是否也在标准目录下,如果不是自己正确的目录可以选择程序所在的位置。
我试过这个:
[Files]
Source: "C:\Data"; DestDir: "{app}"; Flags: ignoreversion
[Code]
function NextButtonClick(PageId: Integer): Boolean;
begin
Result := True;
if (PageId = wpSelectDir) and not FileExists(ExpandConstant('C:\Program\Test\Test.exe')) then begin
MsgBox('YourApp does not seem to be installed in that folder. Please select the correct folder.', mbError, MB_OK);
Result := False;
exit;
end;
end;
但在安装过程中它不会检查它。
无论该程序是否可用,它都会安装它。
我希望有人可以帮助我。
【问题讨论】:
-
你的问题不清楚,如果要检查目标是否存在文件,使用
FileExists函数! -
好的,例如:我安装了一个名为“Abc1”的程序。 "Abc1" 程序目录 "C:\program\Abc1" 并且有 "Abc1.exe" 我创建了一个 txt "Abc1.txt" 并通过安装程序将 "Abc1.txt" "安装" 到 Abc1 目录因为该程序位于那里,如果不在那里,我希望可以选择搜索 Abc1.exe 所在的正确目录。
-
这是一个例子。我希望现在可以理解了