/build/static/layout/Breadcrumb_cap_w.png

Detecting existence of files during packaged install

I have an application I am packaging which has additional configuration steps on initial launch of the application, post install . One of the challenge questions is to “specify” the location of a specific file if it exists on the machine. The other option is to “install” the file if not on the machine, created as part of the install. I need my package to detect if the file exists on the machine. If detected, it should leave the existing file for use with this install. If not detected, then the files need to be installed. I am compiling my ISM with the files in question showing in the folder. With the files existing on the machine for my capture, my thinking is that this should allow for a custom action which would detect the presence of the files.


Can a custom action be added to detect the presence of a file and install the file if not there?


I am very green when it comes to custom actions and especially so when vbscripts are involved. Please be as specific as possible. Any direction is greatly appreciated.

I am using Admin Studio InstallShield 2015 Premier.

Thank you in advance!





0 Comments   [ + ] Show comments

Answers (2)

Posted by: rad33k 7 years ago
Fourth Degree Brown Belt
0
It the mentioned file is in a per-machine location (so is not present under C:\Users\...folder) you can use the AppSearch (+DrLocator and Signature) table(s) to create a file search criteria and store the result in a PROPERTY. Then you can use this PROPERTY as a Condition for a component with the new file (the one that needs to be installed if does not already exist).
In general, PROPERTY from AppSearch is set to TRUE if file exists otherwise it is FALSE. In your case you need to install the new file if does not already exist on a machine so you should use "NOT PROPERTY" (NOT FALSE = TRUE so component will be installed).
In the InstallShield you can use a System Serach wizard described for example --> HERE<--.

If the file is in the User's profile then I would use a VBS CustomAction and Advertised Shortcut. I would install the file to some TMP location (eg. C:\ProgramData\AppName\ConfigFile\) and a VBS CA would copy the file if needed.
Posted by: dragosCI 7 years ago
Senior White Belt
0
Why not having the file in question in a separate component by its own and setting it as a KEYPATH. That way, installer will install only if the file is missing. You can top that up with setting the component attribute to NeverOverwrite(128)

Comments:
  • Bingo! Good catch dragosCI, this is definitely the easiest way.
    @OP You just need to take into account the file replacement rules:
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa368267(v=vs.85).aspx - rad33k 7 years ago
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ