1
votes

I'm trying to make a windows installer using Inno Setup which calls an external command line application. If the external application fails I want Inno Setup to either abort with a message saying that the app should be uninstalled and installed again. Or even better: rollback the installation.

The way I was planning to do this (let me know if you got better ideas) was to write to a log file from the external application if any errors occurs. Inno setup should after calling the external app check if the log file contains the string "ok" or not.

I call my external app like this:

[Run]
Filename: "{app}\exec.exe"; Parameters: "{app}"; AfterInstall: checkLog

And I was planning to have something like:

[Code]
procedure checkLog;
begin

end;

So my question is: How do i retrieve the string from the log and check whether it contains the string "ok" or not? (The path can be a argument to the procedure) And how do I abort the installation with a message or rollback the installation?

1

1 Answers

1
votes

Use

function LoadStringFromFile(const FileName: String; var S: AnsiString): Boolean;

and verify if the string read from the file has OK

http://www.jrsoftware.org/ishelp/