我是Inno的新手,但想在安装前检查"{pf32}\Google\Drive\googledrivesync.exe"是否已安装。
但是,该代码不会像在Check:中对文件那样拾取{pf32}。新的一些你能帮忙吗Michael
[Code]
function InitializeSetup(): Boolean;
var FilePath3, FP1: String;
begin
//Result := FileExists(FilePath3);
//FP1:= {pf32} FilePath3:= 'GoogleDrivegoogledrivesync.exe'
if not FileExists({pf32} + FilePath3) Then
begin MsgBox({pf32} + FilePath3 + 'Google Drive not installed correctly - Setup will now exit - Please reinstall Google Drive!', mbError, MB_OK);
abort;
end;
end;
您必须使用ExpandConstant
才能……好……扩展常量。:-)
function InitializeSetup(): Boolean;
var
FilePath3: String;
PFDir: string;
begin
PFDir := ExpandConstant('{pf32}');
FilePath3:= 'GoogleDrivegoogledrivesync.exe'
Result := FileExists(PFDir + FilePath3);
if not Result then
begin
MsgBox(PFDir + FilePath3 + #13#13 +
'Google Drive not installed' +
'correctly - Setup will now exit.'#13 +
'Please reinstall Google Drive!', mbError, MB_OK);
Abort;
end;
end;
注意:我不记得ExpandConstant
是否包含尾部反斜杠,所以您必须进行测试。如果是这样,则需要删除以FilePath3
开头的反斜杠。