Page 1 of 1

Deleting files after Apply Install

Posted: Thu Jan 11, 2007 1:20 pm
by epohl
I have a question that must have a simple answer but I've looked around and I can't find it.

I have some "temporary" files that get installed via the normal process, and are dealt with after Apply Install (i.e. after the Windows Installer does its business). Once they are installed, I use non-Windows Installer commands or plug-ins to deal with them (Run Program and SQL Server plugin). However, once that's done, I'd like to delete those temp files cleanly. If I use the regular Delete Files command, I have to call Apply Install again. If I use Delete Files Recursively, it removes some directories that I don't want removed. What's the cleanest way to do this?

Thanks,

Eric

Posted: Thu Jan 11, 2007 2:46 pm
by jimo
Put the files in the $SUPPORTDIR$ and use them from there, everything in the $SUPPORTDIR$ get deleted recursively when the installer exits.

Posted: Thu Jan 11, 2007 2:54 pm
by epohl
Excellent! Thanks for the quick response.

A similar question, this time about uninstalling. If I want to delete log files and other files that might have been created by the application, calling "Delete Files" before calling Apply Uninstall doesn't seem to work; I suspect it's because Apply Uninstall is undoing all the things it did in the msi install and nothing more. Again, Delete Files Recursive is a bit heavyhanded to use here. What do you suggest?

Thanks,

Eric

Posted: Thu Jan 11, 2007 2:57 pm
by jimo
Call DLL Function kernel32.dll->DeleteFileA (get result into variable LASTERROR)

~InstallAware Clipboard Data~
~Call DLL Function~
~{19C3F358-47F9-4BF3-B6F6-E10D7C935EFB}~
~kernel32.dll,DeleteFileA,bool,LASTERROR,"pointer to string",$TARGETDIR$\\mylogfile.txt,$~
~mIDEFunc.dll\\mEXEFunc.dll~

Paste that in your MSICode and edit accordingly.