prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Duplicate Folder Creation on Uninstall

Tue Jun 08, 2021 5:26 pm

Hello,

In one of my installer, I have added a popup dialog requesting from the user if he wants to delete certain configuration during uninstallation.
If the user selects "Yes", the installer should delete everything. And this works fine.

However, if the user selects "No", a folder in the installation dir should not be deleted.

In the test project that is attached here, the "Pacakges" folder should not be deleted. But after uninstallation, the a new "Pacakges" folder is created inside the installation directory and the original "Packages" folder goes inside it.

So,
  • When installed: C:\Program Files (x86)\TestCompany\FolderTest\Packages\1.0
  • After unstallation: C:\Program Files (x86)\TestCompany\FolderTest\Packages\Packages\1.0
The reason I do not want the change in the folder structure, is so that if the user installs the application again, he/she will have the old folder intact and all the changes performed inside it.

Thank you.
Prerak
Attachments
FolderTest.aip
(20.58 KiB) Downloaded 200 times

Catalin
Posts: 4342
Joined: Wed Jun 13, 2018 7:49 am

Re: Duplicate Folder Creation on Uninstall

Thu Jun 10, 2021 6:53 pm

Hello Prerak,

Thank you for the provided resources.

I was indeed able to replicate the described behavior.

Now, to be fully honest with you, I am not sure if this is an issue or the intended behavior.

I tend to believe this is the intended behavior, the reason being the fact that we make that option available to our users through a backup.

Basically, during the uninstall, a backup of the "Packages" folder is created --> the folder is removed --> the folder is recreated, resulting in the folder being duplicated.

The solution to this would be setting the "Do not overwrite existing file" on the leaf nodes (e.g. the folders 1.0 and 2.0).

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Duplicate Folder Creation on Uninstall

Fri Jun 11, 2021 10:53 am

Hi Catalin,

Thank you for the suggestion. I managed to make it work now.
However, I had some files inside these folders (1.0, 2.0) so I had to set the Do not overwrite existing file on those files. Because if I set the condition on the leaf folder instead of leaf file, it was showing similar behavior (C:\Program Files (x86)\TestCompany\FolderTest\Packages\1.0\1.0 after uninstall).

Couple of suggestions:
  • It would be better to explain this behavior in the documentation in order to get a clear idea
  • I only had one file inside these folders, so it was very easy for me. However, in a scenario where there are multiple folders with multiple files, adding the condition on each of them would really be a painful task. So, may be adding a way to simplify this would be also a good option.
Thanks once again and have a nice day ahead :)

Prerak

Catalin
Posts: 4342
Joined: Wed Jun 13, 2018 7:49 am

Re: Duplicate Folder Creation on Uninstall

Fri Jun 11, 2021 2:59 pm

Thank you for your followup on this and for offering your feedback, Prerak!

I am glad to hear everything works as expected now.

Regarding your feedback, I will discuss with our Technical Writing team and hopefully we will improve the documentation in the future.

You have a nice day and weekend as well! :)

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Duplicate Folder Creation on Uninstall

Thu Jul 01, 2021 1:15 pm

Hi Catalin,

In one of my other products, the installer creates a folder named "Logs" in the install directory.
Various log files (files not added by the installer) are generated by the application during runtime.

Now, I have set Do not overwrite existing files with the condition (UPGRADINGPRODUCTCODE) on the "Logs" folder.
However, on upgrade, it creates the following folder structure APPDIR\Logs\Logs\*.log which contains the old log files.

The requirement is to preserve the log files during an update and the application will write to the same ones in the future.
But as the files are generated at runtime, I can not set the overwtire condition via the installer.

So, is there a way to achieve the desired behaviour?

Thank you.
Prerak

Catalin
Posts: 4342
Joined: Wed Jun 13, 2018 7:49 am

Re: Duplicate Folder Creation on Uninstall

Tue Jul 06, 2021 5:37 pm

Hello Prerak,

Please accept my apologies for the delayed reply.

I have tried testing this scenario, but I was not quite able to replicate the described behavior.

Here are the steps I took:

- under APPDIR, I created a new folder called "Logs" and left it empty

- "Do not overwrite existing files" on the "Logs" folder with the "UPGRADINGPRODUCTCODE" condition

- installed it

- manually copied a .TXT file in the folder (to mimic your application)

- increased the version of my project --> generated a new product code --> rebuilt the MSI

- installed the new version of the setup

After the install, I noticed that the "Logs" folder was not duplicated.

Is there a step I am missing here? If so, could you please give me a test-case which I can follow in order to reproduce this on my end?

Or, even better, could you please create a sample project that reproduces this and forward it to me?

P.S.: I have tested this using the latest version, 18.4.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”