NI Package Manager (NIPM)

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to set a file not to overwrite if it is already existing?

Solved!
Go to solution

Part of my package contains configuration files. If a package is updating an installation then the configuration files already exist and I do not want to write over them. I don't see a property for this. Is there a way to do this?

0 Kudos
Message 1 of 4
(2,133 Views)

You will need to use something else to that automation. Potentially a small program/script that NIPM can call from the command line.

__________________________________
Bill Eisenhower
Certified LabVIEW & TestStand Developer
Message 2 of 4
(2,129 Views)

In general, it's less idea to have the installer create the config file with the final name because:

  • of this overwriting problem on upgrade, and
  • that if the user uninstalls, then later installs, then the file is also lost (which an upgrade is really an uninstall\install), and
  • repairing the package would also cause the overwrite

An alternative is to either have the application create the config file dynamically if it doesn't exist, OR have the package install the config file under a different name (like "config_template.ini") and have the application copy that into the final name if it doesn't exist. It also has the nice side benefit if the real config file gets corrupted in some way, that the original is still right there to be used as an example or fresh copy.

Message 3 of 4
(2,083 Views)
Solution
Accepted by topic author al_g

I ended up installing the files into %temp% and creating a batch file that copied them from %temp% to the configuration directory if they didn't already exist.

 

robocopy "%temp%" "<config dir>" "config file" /XC /XN /XO

 

/XC = eXclude Changed files

/XN = eXclude Newer files

/XO = eXclude Older files

 

This is along the lines of what Bill suggested.

0 Kudos
Message 4 of 4
(2,035 Views)