PDA

View Full Version : Deleting the Uninstaller


csd214
10-20-2004, 10:22 AM
I'm fond of housekeeping, but only INSIDE the computer (ask my wife).

When the end user wants to uninstall my app (I have some 'dumb' customers), I want to clean up his computer. By default SUF70 saves uninstall.exe (450,000 bytes) in C:\WINDOWS\ProductName. You will notice: After building 10 projects you have 10 occurrences of uninstall.exe (=4,500,000 bytes). After uninstalling your app, the subfolder with content still is on the disk.

In addition you eventually have two log files; by default:
%WindowsFolder%\%ProductName% Setup Log.txt
%WindowsFolder%\%ProductName% Uninstall Log.txt

Personally I don't like to have a lot of files in Windows root directory; I want to put them into subfolders. In SUF70 I always replace the space in the log file names with a backslash. Then I have all three files in the Product Folder under Windows.

Space available isn't the main problem these days. Still I want to 'clean up' when the end user uninstalls my app (can you understand why?). I have now created a global function to perform this task. Just add gu_DeleteUninstaller() to Uninstall Action.On Shutdown.

If you want to delete the log files, you have to add another line: gu_DeleteLogFiles(). All the files are deleted on reboot. (Both 'default location' and 'preferred location' is covered by the function.)

Why create an Uninstall Log and immediately delete it in the same operation? Well, if an error occurs during the uninstall process, the log files can be copied to another location (before reboot). (You can add a message to tell the user to do so.)

I you want to try my functions, save the attached file to the ..\Includes\Scripts folder with .lua extension. You have to add three lines in Actions.On Shutdown. You'll find all instructions as comments in the lua file.

Feel free to comment and suggest improvements! Do you think I'm crazy with my housekeeping? Please tell me.

Josué Alba
10-20-2004, 12:00 PM
Try using a wininit.ini file. it's preatty simple

csd214
10-20-2004, 01:14 PM
Try using a wininit.ini file. it's preatty simple
Sorry, I don't understand. Could you please tell me what you mean? :)
Preferably with an example; the forum users would than have another option to use.

csd214
10-21-2004, 10:34 AM
Try using a wininit.ini file. it's preatty simple
Hello Josué, I'm listening!?

Brett
10-21-2004, 11:30 AM
I think he is referring to the fact that Windows 9x systems use that INI file as a way to delete files on reboot. In our products, use File.DeleteOnReboot to do the same thing and it works on all Windows OSs.

csd214
10-21-2004, 01:12 PM
In our products, use File.DeleteOnReboot to do the same thing and it works on all Windows OSs.

Yes, it works for sure. I have never had any problem with File.DeleteOnReboot during all the year I have used Setup Factory.

I confess; I'm a teaser now, but when Josué steps in and tells "there is en easier way", I think he should tell the forum users HOW. (The challenge in this case is not the delete command, but how to identify the files to be deleted (in a generic function)).

I ran into some "problems" (from my commented source):

-- We can not use UninstallData.GetItem() as an Uninstall action; it will give Error 2864 "Action not available during uninstall."
-- We need the value at Uninstall, we obtain it now (at Setup), creates a Session Variable. That Session Variable we can get when uninstalling.

Q: Is this the correct way to do it?


BTW, I tried the winiit.ini option (on XP), but I couldn't have it to work.

csd214
10-22-2004, 08:32 AM
Sorry, the previously posted lua file is missing closing comment brackets after the description of function #2. This is corrected in the enclosed file and I have added deletion of the "Uninstall files folder".

Save the .txt file with .lua extension.

csd214
10-23-2004, 09:14 AM
The amendment (10/22/04)"Delete Uninstall files folder" should NOT be necessary. According to the uninstall log the last actions (AFTER On Shutdown) are:
Remove uninstall support files
Remove folder: %AppFolder%\Uninstall

The last lines in function gu_DeleteUninstaller() may be removed.

(The reason why the folder wasn't removed the other day, probably was that the folder was opened in a file manager.)

csd214
06-27-2005, 03:08 AM
I should like to warn you if you want to use the uploaded script (post#7). Please read the reflections in http://www.indigorose.com/forums/showthread.php?t=11634 (post#3).

SUF70 isn't capable of reading the specific REG_MULTI_SZ registry entry (due to OS restrictions I suppose). The Delete Uninstall Files can be performed in a proper way by using a "flag file".