简体   繁体   English

Inno Setup - 文件正在使用,禁止跳过/取消

[英]Inno Setup - File in use, disallow skip/cancel

I have configured "Inno Setup" as needed, but there is one point which I'm not able to modify.我已经根据需要配置了“Inno Setup”,但有一点我无法修改。

We have an application which is installed on a network folder on the customers server.我们有一个应用程序安装在客户服务器上的网络文件夹中。 Basically updating the files works as expected.基本上更新文件按预期工作。

If some client on the network, someone which has not initiated the update, has opened the application I'm receiving an messagebox/errorbox "delete file failed.... file is in use by another process" - including 3 buttons "try again", "skip this files (not recommended)", "cancel installation".如果网络上的某个客户端(尚未启动更新的人)打开了应用程序,我会收到一个消息框/错误框“删除文件失败......文件正在被另一个进程使用” - 包括 3 个按钮“再试一次"、"跳过此文件(不推荐)"、"取消安装"。 I have attached an example picture (found on the internet, but the same message).我附上了一张示例图片(在互联网上找到,但消息相同)。

使用中的文件

There you can see the 3 buttons.在那里你可以看到 3 个按钮。 I want to disable "skip this file" and "cancel installation".我想禁用“跳过此文件”和“取消安装”。 The user should have the ability to hit "try again" - they should get stucked until all client have closed their application.用户应该能够点击“再试一次”——他们应该被卡住,直到所有客户端都关闭了他们的应用程序。

I do not think you can alter that message box.我认为您无法更改该消息框。

There are two alternatives:有两种选择:

  • You can delete the target file using your own code before installing the new version, not allowing to proceed until the file is gone.您可以在安装新版本之前使用自己的代码删除目标文件,直到文件消失后才能继续。

     [Files] Source: "Source: "C:\\SampleApplicationData\\*"; DestDir: "{app}\\SampleApp"; \\ Flags: recursesubdirs createallsubdirs; BeforeInstall: ForcedDelete [Code] procedure ForcedDelete; var FileName: string; Deleted: Boolean; begin FileName := ExpandConstant(CurrentFileName); repeat if not FileExists(FileName) then begin Log(Format('File %s does not exist', [FileName])); Deleted := True; end else if DeleteFile(FileName) then begin Log(Format('File %s was deleted', [FileName])); Deleted := True; end else begin MsgBox(Format('Error deleting %s.', [FileName]), mbError, MB_OK); Deleted := False; end; until Deleted; end;

    Though I still believe the code should at least allow an abort.虽然我仍然相信代码至少应该允许中止。

  • Or use restartreplace flag .或者使用restartreplace标志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM