In what order are file operations evaluated - Advanced Installer Community
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

In what order are file operations evaluated

I'm trying to fix a problem that I reported here and that didn't get answered.

In order to make sure that one specific file that might have been created in the application folder never gets deleted, I tried to implement the cleanup routine as follow:

in the application folder, create 2 file removal operations:

one for "*" with condition "(REMOVE="ALL" AND (NOT UPGRADINGPRODUCTCODE))" and "Remove empty folders" check. that one is for cleaning up all leftover files.

One for the specific file (EUR.DTA) that I want to ignore with the condition "false".

My hope is that the second condition will be evaluated first and that the EUR.DTA file will be left alone.

Will that work ?
Antarctica
Posts: 110
Joined: Tue Jul 08, 2014 9:24 am

Re: In what order are file operations evaluated

Your premise is wrong:
I'm trying to fix a problem ... that didn't get answered.
Your question was correctly answered but you chose not to try out their answer.
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: In what order are file operations evaluated

Antarctica wrote:Your premise is wrong:
I'm trying to fix a problem ... that didn't get answered.
Your question was correctly answered but you chose not to try out their answer.
I would respectfully ask that, before accusing me of "choosing not to try their answer", you spend a minute reading my reply and the (unanswered) questions attached. And if you can answer these question, then by all means, please, do not wast any more space in this thread but do post an answer to my first one.

Thank you very much.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: In what order are file operations evaluated

Hello all,

@Antarctica: Thank you for trying to give us a helping hand. We saw you try to use your experience to help other users too. However, I think Fulgan opened this new thread because on the original referenced one he didn't get an answer to his last question, which was true. Due to the high volume of support tickets we have we are forced sometimes to delay our replies. Once again, thank you for your contribution on our forums.

@Fulgan: I really apologize for my delayed reply. I do not think the solution you exposed here (using the Uninstall Cleanup feature) will work. When the condition of a file removal operation is false, the related removal operation is just skipped, but the file is not preserved. It will be deleted by the second uninstall cleanup job (* - delete all files).

To get back to your initial request, I think my original answer was not so clear because I didn't give you detailed instructions. Here is what you should try:

1. go to "Files and Folders" page and add a version of the file you want to preserve (it must have the same file name and resolve at install time to the same file path as the targeted file you want to preserve)
2. right click on the added file and go to "Properties"
3. go to the "Operations" tab and enable the "Do not overwrite existing file" option with the "Condition" field set to 1; this means that the file on disk will be always preserved when present
4. build your setup project and test it

Let us know if this helped and once again I apologize for my tedious reply.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: In what order are file operations evaluated

Thank you for your answer.

I tested your suggestion and, unfortunately, it does not do what I'm expecting: on a clean install, it will deploy the file in the target location. that is NOT the correct behavior: that file will only be present in legacy deployment that still have that config file deployed in the same location as the application. Adding that file to the deployment actually makes the application unusable since it contains the basic configuration data for the app and there is no way to generate that in advance or from the installer and the application will use it if it is found (instead of going through the initialization procedure that prompts the user for the correct data).

What I really need is a way to make sure that the UNINSTALL procedure will ignore that file if present but I do not need or want the file to be deployed.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: In what order are file operations evaluated

Hello,

To avoid the current setup file installation when original file is not present on disk, then you can create a file search to look for the original file and use the file search property to condition the installation of file component from the project.

Basically you can proceed like this:
1. go to "Search" page and create a file search (i.e. FILE_EXISTS) which will check the presence of original file on disk
2. go to "Files and Folders" page and select the file added in the project; right click on it and choose "Go To Component" option
3. on the selected component from "Organization" page add the following condition

Code: Select all

FILE_EXISTS
4. rebuild and test the installation scenarios again

This way the file from project will be installed only when the original file exists on disk, but at the same it will be overwritten with the one from disk.

Hope this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: In what order are file operations evaluated

Thank for your answer
This way the file from project will be installed only when the original file exists on disk, but at the same it will be overwritten with the one from disk.
Does that actually mean that, in the end, the original file on disk will not be overwritten if present during install?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: In what order are file operations evaluated

Yes, that's right.

Just let us know if you have any further issues.

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

Return to “Common Problems”