01-07-2010 11:08 AM
When creating a distribution kit, there is an option to launch an application
after installation.
I would like to launch an application BEFORE installation.
Is this possible with the installer?
Specifically, I would like to run a program to save the configuration
files from the previous installation (which may have been modified
by the user) before allowing the installation of the new software to proceed.
Thanks in advance,
Marty O.
Solved! Go to Solution.
01-07-2010 11:20 AM
Unfortunately there is no mechanism to support that functionality. One alternative I would suggest is that instead of installing your config files, you have your application create them if they are not found. This way, your installer does not have to include them and will not overwrite them. The first time your application is run on a new machine, it will detect that the files are missing, and will create them with default settings. From then on, it will just read those files in. Your user can edit them without fear of losing changes in an upgrade.
Mert A.
National Instruments
01-07-2010 05:34 PM
Mert,
I like that idea. Why didn't I think of it?
Instead of compiling in the defaults, however, I decided to ship a sample file
and copy it to the correct location if the config file is not found.
Thanks,
Marty O.
01-14-2010 05:57 PM
Well, that didn't quite work. I was hoping that the installer would leave
the old config file in place, but it deleted it. The running my application
duly created a new one.
Is there an option to specify when building the distribution to tell it to
leave files alone that happen to be in the install directory but are not
part of the distrib? I took a quick glance at the edit window, but didn't
see anything.
By the way, this is using CVI 8.5.
Thanks for any further thoughts.
Marty O.
01-14-2010 06:19 PM
Files that weren't installed by the distribution should not be uninstalled by the distribution. Are you certain that's what's happening? For sanity's sake, I tried this in version 8.5.1, and it worked as expected. If you install a default config file, that one will be uninstalled, but any copies you make of it will stick around. You might try installing your distribution, manually copying a file into the directory, then uninstalling. That would distinguish whether the entire directory is being wiped out, or just your particular config file.
Let me know what you find.
Mert A.
National Instruments
01-18-2010 12:44 AM - edited 01-18-2010 12:45 AM
Marty,
I'm not sure you applied exactly what Mert described.
You shouldn't have put a file into the distribution kit.
That file, I guess, is what you referred as "old config file" in your message. That file, being a part of the installation, is subject to removal by the uninstaller. This is expected behavior.
Instead, you should be creating the file in your executable (using a function like fopen, OpenFile, etc.) upon its first run on that computer.
Of course you need to check first if the file exists.
Hope this helps,
01-19-2010 11:56 AM