enigma
Posts: 89
Joined: Fri Jun 08, 2007 10:12 am

Delete off version folder in Application Data folder

Hi,

I found that if we access Application.UserAppDataPath property in our .Net program, then an extra folder named %versionNumber% will be created inside the ApplicationData folder.

My question is, during the uninstallation time, I want the AI to delete this folder. So let say I uninstall "MyApp" version 1.0.0.0 from the computer, then I want the folder named "1.0.0.0" inside the ApplicationData is also removed.

Is there anyway to do this?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

There is a similar discussion on the forum, please take a look:
http://www.advancedinstaller.com/forums ... ove+folder

Note that instead of "PROPERTY" you can use "AppDataFolder" which is resolved at runtime to "Documents and Settings\[current_user]\Application Data".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
enigma
Posts: 89
Joined: Fri Jun 08, 2007 10:12 am

cosmin wrote:Hi,

There is a similar discussion on the forum, please take a look:
http://www.advancedinstaller.com/forums ... ove+folder

Note that instead of "PROPERTY" you can use "AppDataFolder" which is resolved at runtime to "Documents and Settings\[current_user]\Application Data".

Regards,
Cosmin
Hi, thank you for your reply.

However, there are two problems I encountered with the above method:
  • If I set the Session.Property("AppDataFolder"), I can't delete the application data because there is no permission for me to do this. Is there anyway to override this permission thing?
  • Actually, I need to delete a folder inside the Application Data Folder, not the application data itself. I don't know how to set the path for this one. The folder that I want to delete always has the product version as the folder name. So, if the application version is 1.0.0.0, the folder I want to delete is [AppDataFolder]\1.0.0.0. I set the path as "ApDataFolder\ProductVersion",ession.Property("AppDataFolder\ProductVersion") returns me a null string
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
If I set the Session.Property("AppDataFolder"), I can't delete the application data because there is no permission for me to do this. Is there anyway to override this permission thing?
Note that it is not recommended to delete the Application Data folder.

What I meant in my previous post was that you can use AppDataFolder to find the folder that will be deleted. Therefore you will make this modification:

Code: Select all

pathToFolder=Session.Property("AppDataFolder")&Session.Property("ProductVersion")
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Feature Requests”