Page 1 of 1

Uninstallation of local files

Posted: Tue Aug 26, 2014 8:39 pm
by johnbyerly
I am copying some local files during installation. I understand from the documentation that, in order to have the files uninstalled automatically, I need to use the native engine. So, I tried this:

Code: Select all

Set Variable NATIVE_ENGINE to TRUE
Does Folder Exist $EXEDIR$\AuxFiles (get result into variable AUXFILES)
if Variable AUXFILES Equals TRUE
  Does File Exist $EXEDIR$\AuxFiles\logo.png (get result into variable LOGOFILE)
  if Variable LOGOFILE Equals TRUE
    Copy Local Files $EXEDIR$\AuxFiles\logo.png to $TARGETDIR$  end
end
Set Variable NATIVE_ENGINE to FALSE
Apply Install (get result into variable SUCCESS)


Unfortunately, logo.png is not removed during uninstall. What am I doing wrong?

Thanks!

JAB

Re: Uninstallation of local files

Posted: Wed Aug 27, 2014 11:45 am
by FrancescoT
Dear Jab,

those files will not be removed during un-install because are not part of your install process database.

It is true that the IA documentation about the command reports; "the files copied/moved by the command will be uninstalled normally without requiring manual deletion under NATIVE ENGINE" ... but with your approach, you are still using the Windows Installer Engine.

Because I suppose that it is your intention to continue to use the Windows Installer Engine, you must delete those files at un-install time via script and I may suggest you the following approach.

At Install Time:

Code: Select all

Apply Install (get result into variable SUCCESS)

Set Variable NATIVE_ENGINE to TRUE
Does Folder Exist $EXEDIR$\AuxFiles (get result into variable AUXFILES)
if Variable AUXFILES Equals TRUE
  Does File Exist $EXEDIR$\AuxFiles\logo.png (get result into variable LOGOFILE)
  if Variable LOGOFILE Equals TRUE
    Copy Local Files $EXEDIR$\AuxFiles\logo.png to $TARGETDIR$  end
end
Set Variable NATIVE_ENGINE to FALSE


At Un-Install Time:

Code: Select all

Set Variable NATIVE_ENGINE to TRUE
Delete Files $TARGETDIR$\logo.png
Set Variable NATIVE_ENGINE to FALSE

Apply Uninstall (get result into variable SUCCESS)


With the above approach, the NATIVE ENGINE is only enabled in order to permit the immediate execution of the Windows Installer Commands (Purple Commands); Copy Local Files and Delete Files.

Hope this helps you.

Re: Uninstallation of local files

Posted: Wed Aug 27, 2014 2:10 pm
by johnbyerly
Grazie mille!

Re: Uninstallation of local files

Posted: Thu Aug 28, 2014 10:53 am
by FrancescoT
:D