使用 Inno Setup 安装更新时,不要覆盖设置文件

问题描述 投票:0回答:1

我已经为 C++ 应用程序创建了一个 Inno Setup 脚本。该脚本运行良好,包含以下内容:

[Files]
Source: "C:\Users\john\Desktop\My_App_setup\my_app.exe"; \
    DestDir: "{app}"; \
    Flags: ignoreversion
Source: "C:\Users\john\Desktop\My_App_setup\settings\*"; \
    DestDir: "{app}\settings"; \
    Flags: ignoreversion recursesubdirs createallsubdirs

这些文件是 C++ 可执行文件

my_app.exe
和由最终用户自定义的设置文本文件。

我想做的是,当我有新版本的

my_app.exe
时,仅更新此文件并保留用户迄今为止可能已更改的相同设置。

我应该尝试什么?

installation inno-setup
1个回答
15
投票

只需添加

onlyifdoesntexist
标志:

Source: "C:\Users\john\Desktop\My_App_setup\settings\*"; \
    DestDir: "{app}\settings"; \
    Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist
© www.soinside.com 2019 - 2024. All rights reserved.