We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Antony
Posts: 15
Joined: Sun Nov 16, 2014 11:02 am

cleanup DESTDIR before installation

i made an installer but i need to remove all files in DESTDIR before installing by checking a checkbox for exemple, how i can do this?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: cleanup DESTDIR before installation

Hello,

I'm not sure I fully understand your scenario.
Can you please give us more details, maybe exemplify? What is the DESTDIR folder? Is it a custom folder created by your application, or it is created by the installation package?

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Antony
Posts: 15
Joined: Sun Nov 16, 2014 11:02 am

Re: cleanup DESTDIR before installation

i got a standard destdir like C:\Games\xxx but posibility to change in any location where the original game is installed
my app have to clean the folder yyy located in C:\games\xxx\yyy or in userchoice\xxx\yyy
yyy is a special folder in the game directory which allow modified files for the game
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: cleanup DESTDIR before installation

Hi Anthony,

Please note that this is the default behavior; during an uninstall, Windows Installer removes only the data registered into the MSI file. All other data created by custom actions, by the installed application or by the user is not registered in the MSI, therefore it will not be removed.

If you want to also delete this data, you can use the Uninstall Cleanup wizard feature to remove any redundant files or folder. On the Files and Folders page, simply right click the folder that needs to be cleaned up upon uninstall and click Uninstall Cleanup. The “Wizard” will guide you through the rest of the process.

If you need any help, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Antony
Posts: 15
Joined: Sun Nov 16, 2014 11:02 am

Re: cleanup DESTDIR before installation

i need during my program install's this folder to be cleaned not to uninstall after
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: cleanup DESTDIR before installation

Hi Anthony,

For this you can use a custom action to remove all files in DESTDIR before installing. You can condition the custom actions execution by the checkbox state.
For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action with sequence. This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.
You can also take a look on the Options to integrate and debug custom actions article which may be useful to you.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Antony
Posts: 15
Joined: Sun Nov 16, 2014 11:02 am

Re: cleanup DESTDIR before installation

if i use this script :

strDirectory = "DESTDIR"

Set FSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = fso.GetFolder(strDirectory)

For Each objFile in objFolder.Files

objFile.Delete True
Antony
Posts: 15
Joined: Sun Nov 16, 2014 11:02 am

Re: cleanup DESTDIR before installation

so any feedback if it works with that kind of script?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: cleanup DESTDIR before installation

Hello,

First of all I apologize for our very delayed reply.

Yes, it should work when using a custom action script like the above. I've tested the following script and it succeeded:

Code: Select all

strDirectory = "DESTDIR"

Set FSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = fso.GetFolder(strDirectory)

For Each objFile in objFolder.Files

objFile.Delete True

Next
However, as another option you can also try to use the "Folder Removal" or the "File Removal" support from "Files and Folders" page.

Also, you can take a look on our "Remove a file or a folder during installation" article which could be useful for you.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Antony
Posts: 15
Joined: Sun Nov 16, 2014 11:02 am

Re: cleanup DESTDIR before installation

i created a custom action with this code in "ExecuteScriptCode" and attached with a checkbox button but it returns an error at install if i check the box, any ideas????
and thanks a lot for helping
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: cleanup DESTDIR before installation

Hello,

Can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

If you cannot disclose your project file you can try to replicate the behavior in a sample (new project with dummy files) and send it us so we can test and investigate on our side.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”