我会尽量简短而不附上所有相关的源文件。在我的 Pascal 知识允许的范围内,我已经尽可能多地找到了这个问题......
我发现我在步骤ssInstall中发现了一个磁盘缓存问题。我有一个应用程序的安装程序,如果它发现安装了较旧的应用程序版本,它将调用如下卸载:
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;
文件夹/文件也定义如下:
[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...
测试用例1;正常安装:一切顺利。日志文件部分:
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...
测试用例2;更新旧版本:当进入步骤ssInstall时,卸载程序启动,它完成然后安装开始。日志文件部分:
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 <--- !!!
-- File entry --
Dest filename: C:\Program Files\MyApp\unins001.exe <--- !!!
blah...
如您所见,某些文件夹未创建,并且我的应用程序稍后在尝试写入“db”文件夹时失败。
如果我取消注释Sleep()命令,一切都会顺利运行,并且两个日志文件都是相同的。
磁盘似乎有足够的时间来刷新更改!不知何故,inno-setup 中必须缺少一个 flush() 命令。
任何一位无知的大师都可以发表评论或以某种方式提供帮助吗?我可以调用flush()而不是sleep()吗?任何帮助表示赞赏。我只是想在提交错误请求之前确定一下。