- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Create $PRODUCT_NAME$ folder automatically to user selected installation location
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
Create $PRODUCT_NAME$ folder automatically to user selected installation location
Hi,
I have configured a installer project.
Now the default install location is Ex: C:\Program Files\$PRODUCT_NAME$
When the user select a custom install location it would be Ex: F:\test
In this case if the user accidentally select a folder containing other files/folders, when the application is uninstalled, all the contents in the folder will be deleted.
This is a major issue.
What I wanted to do is, add the $PRODUCT_NAME$ folder to custom install location, when the user select a custom install location.
So that the final custom install location would be Ex: F:\test\$PRODUCT_NAME$
Please help and guide to achieve this in the installer configuration window or adding a plugin if impossible.
Thank you.
Hi @ishanu ,
When the user select a custom install location containing other files/folders, when the application is uninstalled, only the the installed application will be deleted.
However we can use Custom Code to modify the custom install folder. Develop custom code to extract the value of $USER_INSTALL_DIR$ variable and concatenate it with the extracted value of $PRODUCT_NAME$ variable. Set the concatenated value to $USER_INSTALL_DIR$ variable using InstallerProxy setVariable() and configure Execute Custom Code action.
Have attached custom code Sample.zip which include a sample InstallLocationModifier class.
Steps to configure Execute Custom code action:
Add "Execute Custom Code" action after the "Choose Install Folder" panel in
Sequence->PreInstall phase
Configure the path of attached Sample.zip in the action and set the class name as InstallLocationModifier.
Build and run the installer & set a custom install location.
Screen shot & sample custom code attached.
Hope this helps.