Reputation: 35
I'm new to Inno, but want to check '{pf32}\Google\Drive\googledrivesync.exe' is installed before install.
However, the code does not pick up {pf32} as it does in Check: for a file. New some can you assist please Michael
[Code]
function InitializeSetup(): Boolean;
var FilePath3, FP1: String;
begin
//Result := FileExists(FilePath3);
//FP1:= {pf32} FilePath3:= '\Google\Drive\googledrivesync.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;
Upvotes: 2
Views: 5581
Reputation: 125651
You have to use ExpandConstant
in order to...well...expand constants. :-)
function InitializeSetup(): Boolean;
var
FilePath3: String;
PFDir: string;
begin
PFDir := ExpandConstant('{pf32}');
FilePath3:= '\Google\Drive\googledrivesync.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;
NOTE: I don't recall off-hand if ExpandConstant
includes the trailing backslash or not, so you'll have to test. If so, you'll need to remove the backslash that starts FilePath3
.
Upvotes: 2