Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Uninstalling files created by my application.


3 replies to this topic

reidhoch

reidhoch
  • Full Members
  • 2 posts

Posted 12 August 2009 - 20:33

I am using InstallShield 2009, how do I direct it to delete files that were created by my application. My problem stems from the fact that my app creates some cache files that the uninstaller does not remove. If the installer installs in the same directory, this causes the application to crash on launch.

daengh

daengh
  • Full Members
  • 8 posts

Posted 12 August 2009 - 21:37

If they're in a standard location, add an Installscript function to delete them. Note that this should not be in \Program Files anymore.

If the users can select the location, you're going to have to record that somewhere (INI file, registry, ?) so you can look it up.

OT: why does your app crash if it finds the cache files? Can it not clear them on first startup?


reidhoch

reidhoch
  • Full Members
  • 2 posts

Posted 12 August 2009 - 21:47

We have an Eclipse based application, for some reason Eclipse creates a series of cache files that once you install over them cause the application to crash. I'm fairly new to InstallShield, could you point me in a good direction regarding writing InstallShield functions?

Maharani

Maharani
  • Full Members
  • 50 posts

Posted 13 August 2009 - 08:13

QUOTE (reidhoch @ 2009-08-12 22:47)
We have an Eclipse based application, for some reason Eclipse creates a series of cache files that once you install over them cause the application to crash. I'm fairly new to InstallShield, could you point me in a good direction regarding writing InstallShield functions?

At the beginning of the script file (usually setup.rul) declare your function:

CODE
prototype RemoveAdditionalFiles();


Implement your function after all the declarations. Our setup creates a text file containing the versions of all modules in the installation folder with each installation and update. These files have to be removed on uninstalling:

CODE
function RemoveAdditionalFiles()
 string szTargetPath, szFile;
 number nResult;
begin
 szTargetPath = TARGETDIR ^ "Bin";  
 LongPathToQuote(szTargetPath, FALSE);
 nResult = FindAllFiles(szTargetPath, "Setup_Versions_*.txt", szFile, RESET);
 while (nResult = 0)
   DeleteFile(szFile);
   nResult = FindAllFiles(szTargetPath, "Setup_Versions_*.txt", szFile, CONTINUE);
 endwhile;
 nResult = FindAllFiles(szTargetPath, "Setup_Versions_*.txt", szFile, CANCEL);
end;


Call the function in the uninstall routine. Depending on whether you want to remove the files before uninstallation starts or after uninstallation was made you have to put the call in either OnMaintUIBefore or OnMaintUIAfter, which handles both uninstallation and repair/upgrade/maintenance of the program. You have to check for REMOVEALLMODE in both cases, otherwise the files would be removed in repair mode as well.
You could call the function in one of the feature uninstall handlers as well.

Hope this helps
Rita