2017-05-24 57 views
1

我已经为我想作为更新程序创建的文件创建了文件。
我希望在安装之前检查程序是否也在标准目录下,如果没有,那么它本身就是正确的目录可以选择程序的位置。Inno安装程序检查文件是否存在于选定的目标位置

我已经试过这样:

[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; 

但在安装过程中不检查。
无论程序是否可用,它都会安装它。

我希望有人能帮助我。

+0

你的问题不清楚,如果要检查文件是否在目标存在,使用'FileExists'功能! – GTAVLover

+0

好吧,例如:我有一个程序安装名称“Abc1”。 “Abc1”程序目录“C:\ programme \ Abc1”并且存在“Abc1.exe” 我创建了一个txt“Abc1.txt”并且安装程序将“安装”“Abc1.txt”到Abc1目录,因为该程序位于那里,如果不存在,我想有可以选择正确的目录搜索Abc1.exe的位置。 – timsen96

+0

这是一个例子。 我希望现在可以理解 – timsen96

回答

0

您必须使用{app}不断的测试,以检查选择的文件夹:

FileExists(ExpandConstant('{app}\Test.exe')) 
相关问题