进行更新时如何强制 install4j 不覆盖特定文件
我已经创建了 Install4j 项目,到目前为止,我对安装、卸载和更新过程感到满意。然而,出现了一种新情况,当用户更新产品的新版本时,我需要阻止 install4j 覆盖用户安装目录中的特定文件。谁能告诉我如何强制/配置 install4j,以便在更新现有安装时不会覆盖特定文件。
例如,当我安装应用程序时,我将数据库文件 (mydb.script) 作为安装文件的一部分包含在内,以便用户可以使用数据库。我发现当我创建应用程序的新版本并再次安装它时,install4j 已经检测到我安装了以前的版本并询问我是否要更新该版本。我点击“是”,它就完成了它的工作。然而,在此过程中,它实际上用安装程序内部的数据库覆盖了以前的数据库(导致用户丢失自第一次安装以来输入的所有数据)。我不想要这种行为。我想告诉 install4j 不要覆盖这个特定文件(如果存在)。
I have created my Install4j project and I am happy with the installation, un-installation and update process so far. However, a new situation have presented itself where I need to stop install4j from overwriting a specific file in the user's installation directory when the user does an update to an new version of the product. Can anyone tell me how to force/configure install4j so that it does not overwrite a specific file when updating an existing installation.
For example, when I install my application I include a database file (mydb.script) as part of the installation files so that the user will have a database ready to use. I found out that when I create a new version of my application and install it again, install4j already detect that I have a previous version install and ask if i want to update that version. I click 'Yes' and it does its job. However, during this process, it actually overwritten the previous database with the one inside the installer (resulting in the user losing all of their data that they have entered since the first installation). I don't want this behavior. I want to tell install4j to not overwrite this particular file if it exists.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
覆盖策略可以在分发树中控制。请参阅下面的屏幕截图,它显示了“Hello world”示例项目的分发树。 vmoptions 文件不应被覆盖,因此其覆盖策略设置为“never”。
如果您在目录条目中包含文件并且只想更改单个文件的覆盖策略,只需除了目录条目之外还添加单个文件(在这种情况下,您可能必须手动创建父目录)。单个条目的设置将覆盖目录条目的设置。
The overwrite policy can be controlled in the distribution tree. See the screen shot below, it shows the distribution tree of the "Hello world" sample project. The vmoptions file should not be overwritten, so its overwrite policy is set to "never".
If you include files with a directory entry and just want to change the overwrite policy for a single file, simply add the single file in addition to the directory entry (you might have to create parent directories manually in that case). The settings for single entries will override settings for directory entries.