cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
apollo323
Level 2

Checking for a file in destination folder

Hi,

This will be the first version of our product that is being released with InstallShield as the installer. Between that and significant changes to the software, we want to prevent the user from installing to a folder containing an old version of the software.

Anyone have any ideas on how I could achieve this? I can write installscript easy enough to decide whether or not the INSTALLDIR path variable contains an old executable, however I can't work out how to actually use that in my sequence.

Any help would be most appreciated!

Regards,

Ben
Labels (1)
0 Kudos
(2) Replies
MGarrett
Level 6

For Installscript, you can do it by creating a check for the existing app using SdAskDestPath() in your OnFirstUIBefore() event.
See the SdAskDestPath and SdAskDestPath2 examples in the InstallScript language reference.

Pseudocode would go something like this:


svDir = c:\\somepath
SdAskDestPath (TITLE_TEXT, "", svDir, 0)
while svDir contains yourapp.exe
Display error "Cannot overwrite existing installed app"
SdAskDestPath (TITLE_TEXT, "", svDir, 0)

endwhile
INSTALLDIR = svDir

Of course, this doesn't include error checking or checking for next/back/cancel buttons, but you get the idea.
0 Kudos
apollo323
Level 2

Would I need to have a completely "Installscript" install? At the moment I have a Basic MSI.
0 Kudos