Reputation:
I have a directory (Configurationfiles
) containing 84 files. One of these files contains data that the user will modify (UserData.json
). This file may or may not be there, but if it is I don't want to lose this data, and am trying to keep the install user friendly.
I am trying to modify an existing an install script that does all of the following:
UserData.json
UserData.json
is missing copy default UserData.json
UserData.json
is present prompt user to overwrite UserData.json
, if yes overwrite, if no don'tCurrently all of the files are copied no matter what and I never get a prompt to overwrite. This is what I have so far:
#define ExcludeFiles "UserData.json"
Source: ..\..\PROV\4200701\BIN\*.*; Excludes: {#ExcludeFiles }; DestDir: {app}\BIN; \
Flags: ignoreversion recursesubdirs skipifsourcedoesntexist;
Source: ..\..\PROV\4200701\BIN\Configurationfiles\UserData.json; \
DestDir: {app}\BIN\Configurationfiles;
Flags: ignoreversion onlyifdoesntexist confirmoverwrite skipifsourcedoesntexist;
I think I have something set up incorrectly with the flags. But I am not sure. Does anyone see where I am going wrong?
Upvotes: 2
Views: 505
Reputation: 469
You can never get the confirmation, as the onlyifdoesntexist
prevents the confirmoverwrite
from ever taking any effect.
I do not think, that you are correct with "all of the files are copied no matter". When I test your script, I get:
2020-09-26 16:51:21.625 -- File entry --
2020-09-26 16:51:21.626 Dest filename: C:\Users\pimpo\AppData\Local\My Program\BIN\Configurationfiles\UserData.json
2020-09-26 16:51:21.626 Time stamp of our file: 2020-09-26 16:49:30.000
2020-09-26 16:51:21.626 Dest file exists.
2020-09-26 16:51:21.626 Skipping due to "onlyifdoesntexist" flag.
If you remove the onlyifdoesntexist
, your script should do what you want.
2020-09-26 16:57:41.066 -- File entry --
2020-09-26 16:57:41.067 Dest filename: C:\Users\pimpo\AppData\Local\My Program\BIN\Configurationfiles\UserData.json
2020-09-26 16:57:41.067 Time stamp of our file: 2020-09-26 16:49:30.000
2020-09-26 16:57:41.067 Dest file exists.
2020-09-26 16:57:41.067 Time stamp of existing file: 2020-09-26 16:49:30.000
2020-09-26 16:57:41.067 Message box (Yes/No):
C:\Users\pimpo\AppData\Local\My Program\BIN\Configurationfiles\UserData.jsonThe file already exists.
Would you like Setup to overwrite it?
2020-09-26 16:57:43.055 User chose Yes.
2020-09-26 16:57:43.055 Installing the file.
2020-09-26 16:57:43.062 Successfully installed the file.
You might want to remove the ignoreversion
too, as it has no effect on .json
files. It may confuse others. The skipifsourcedoesntexist
is also questionable.
Upvotes: 1