2

My software package installs a file (JSON) that saves user data. This data file should not be replaced when the user installs a new version of my software. I'm using Inno Setup to create my install package and I'm using "onlyifdoesntexist" flag to achieve this.

Here is the code.

Source: "C:\MyProg\Json\userData.json"; DestDir: "{app}\MyProg\Json"; Flags: onlyifdoesntexist

But, now I would like to add new objects/array to the "userData.json" as a new update. If continue to use the above code after adding the changes to the file, it won't get updated in the user's end. So I would like to know whether there a way to check the versions of the files or only update if the installation has a new version.

Is this possible in Inno Setup ? Thanks for you help in advance.

3
  • The onlyifdoesntexist flag instructs Inno Setup to copy the file only if it doesn't already exist. If you remove it, the file will be copied (overwritten) even if already exists.
    – TLama
    Mar 27, 2014 at 12:49
  • Thanks for your answer, I'm going to remove the flag in the version (ex. v1.5) that has the new userData.json and add the flag again in the next version (ex. v1.6). But this will make a situation where all the users who's got versions below v1.5 and would like to update to a version higher than v1.5, they'll always have to install v1.5 before updating to a newer version to get the changes done to "userData.json". is there a way to update this file without making this issue ? Mar 27, 2014 at 13:02
  • So, you are looking for a way how to overwrite that file only if it's older ? If so, then you might add the comparetimestamp, but you'll have to deal with some daylight saving troubles when using that flag.
    – TLama
    Mar 27, 2014 at 13:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.