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

How do you stop an install if a folder already exists

My current program is broken down into 2 parts. One if a full install of the application and the other is an upgrade. This is mostly done to help reduce the size of the upgrade file. However I do get people from time to time downloading the full install and using that. This however has become a problem due to a clean .dbc file that is included in the install and not the patch. This ends up overwriting the file and causing my application not to work.

What I want to do is have IS 2012 determine that the folder exists, pop up an error message saying something along the lines of you already have installed the full version of this application, please download and run the upgrade and then exit out of the installation before any files are unpacked.

Any help would be greatly appreciated.
Labels (1)
0 Kudos
(2) Replies
Level 7

If your project is an InstallScript Msi project, allowing you to use *.rul InstallScript files, you can modify the following code snippet, taken from the InstallShield Help editor:

* InstallShield Example Script
* Demonstrates the ExistsDir function.
* AskPath is called to get a directory name from the user.
* Then, ExistsDir is called to determine whether the directory
* exists.
#define TITLE_TEXT "ExistsDir Example"

// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"

export prototype ExFn_ExistsDir(HWND);

function ExFn_ExistsDir(hMSI)
STRING svPath;
// Get the path to be created.
AskPath ("Please enter a path:", "", svPath);
// Check for the existence of the directory.
if (ExistsDir (svPath) = EXISTS) then
SprintfBox (INFORMATION, TITLE_TEXT, "%s already exists.", svPath);
SprintfBox (INFORMATION, TITLE_TEXT, "%s does not exist", svPath);
0 Kudos
Level 7

If the concern is that overwriting a particular file causes problems only when the full setup is run, when the product already exists, would it be helpful to set the Component condition to NEVER_OVERWRITE that particular file, rather than adding another dialog to the setup?
0 Kudos