I will try to be as concise as possible without linking all related source files. I traced the problem in the same way that my knowledge of Pascal allows me ...
I discovered a disk caching problem that occurs for my case in the ssInstall step. I have an installer for an application that, if it finds an older version of the application, will cause the uninstall as follows:
procedure CurStepChanged(CurStep: TSetupStep); var uninstallStr: String; ResultCode: Integer; begin if (CurStep = ssInstall) and IsUpdatableApplicationInstalled() then begin uninstallStr := GetUninstallString(); uninstallStr := RemoveQuotes(uninstallStr); Result := Exec(uninstallStr, '/SILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_HIDE, ewWaitUntilTerminated, ResultCode); if Result and (ResultCode = 0) then Log('CurStepChanged = ssInstall; uninstall OK'); //------------- //Sleep(30000); //------------- end;
Also folders / files are defined as follows:
[Dirs] Name: "{app}\db"; Flags: uninsalwaysuninstall [Files] Source: "..\bin\*"; DestDir: "{app}\bin"; Flags: ignoreversion createallsubdirs recursesubdirs Source: "..\java\jre\*"; DestDir: "{app}\jre"; Flags: ignoreversion recursesubdirs createallsubdirs blah...
Test case1; Normal installation: everything goes smoothly. Part of the log file:
Starting the installation process. Creating directory: C:\Program Files <--- Creating directory: C:\Program Files\MyApp <--- Creating directory: C:\Program Files\MyApp\db <--- Creating directory: C:\Program Files\MyApp\jre <--- Creating directory: C:\Program Files\MyApp\jre\lib Creating directory: C:\Program Files\MyApp\jre\lib\applet Directory for uninstall files: C:\Program Files\MyApp Creating new uninstall log: C:\Program Files\MyApp\unins000.dat <--- !!! -- File entry -- Dest filename: C:\Program Files\MyApp\unins000.exe <--- !!! blah...
Test case2; Update the old version: when the ssInstall step is reached , the uninstall program starts, it ends, and then the installation starts. Part of the log file:
CurStepChanged = ssInstall; uninstall OK Starting the installation process. Creating directory: C:\Program Files\MyApp\jre\lib Creating directory: C:\Program Files\MyApp\jre\lib\applet Directory for uninstall files: C:\Program Files\MyApp Creating new uninstall log: C:\Program Files\MyApp\unins001.dat <
As you can see, some folders are not created, and my application does not work later when it tries to write to the 'db' folder.
If I uncomment the Sleep () command, everything runs smoothly and both log files are identical.
The disk seems to have enough time to discard changes! Somehow or other inno-setup is missing the flush () command.
Can any of the Innoguru comment or help? Is there a flash () that I could call instead of sleep ()? Any help is appreciated. I just want to be sure before I submit an error request.