我需要安裝程序檢查目標位置是否存在文件,如果不存在,則安裝將中止。我的項目是一個更新補丁,因此如果應用程序的主要exe文件不在目標中,我希望安裝程序避免安裝更新文件。我怎樣才能做到這一點?Inno Setup - 檢查文件是否存在於目標位置,或者如果不中止安裝
有人可以舉一個代碼示例來檢查通過Windows註冊表的文件版本嗎?
[Files]
Source C:\filename.exe; DestDir {app}; Flags: ignoreversion; BeforeInstall: CheckForFile;
[code]
procedure CheckForFile(): Boolean;
begin
if (FileExists('c:\somefile.exe')) then
begin
MsgBox('File exists, install continues', mbInformation, MB_OK);
Result := True;
end
else
begin
MsgBox('File does not exist, install stops', mbCriticalError, MB_OK);
Result := False;
end;
end;
通常情況下,更新安裝,你只需要使用相同的AppID,以及創新科技將處理剩下的給你。有關更多詳細信息,請參閱[本文](http://www.vincenzo.net/isxkb/index.php?title=Upgrades)。 – Deanna