How to remove locally created files during uninstall
From Forum Nokia Wiki
Problem
Uninstall does not remove all files that were created either during the installation of the application or during the execution of the application.
(This problem can prevent an application passing Symbian Signed testing).
Solution
Ensure that all files created on the device during the installation or execution of the application are removed on uninstall. If the name and location of the files/directories are known beforehand, the FILENULL option in the package file can be used to remove them during uninstallation. Masks can be used with FILENULL to remove a group of files (in your .pkg file):
... "" - "!:\system\apps\SomeApp\temp.dat", FN "" - "!:\system\apps\SomeApp\*.log", FN ...
See the package file format description in the SDK Help for more information on using FILENULL.
S60 3rd Edition
Since Symbian OS v9.1, there is an easier way to ensure that application files are removed during uninstall. The private folder should be used to store application-created files; this folder will be removed automatically during application uninstall. The private folder usually has the form “\Private\<SID>\”. The private folder can be requested at run time with the RFs::PrivatePath(…) method. The following example demonstrates how a file can be created in the private folder:
_LIT( KTempFilename, “temp.dat” ); TFileName tempFilePath; RFile tempFile; RFs fs; User::LeaveIfError( fs.Connect() ); CleanupClosePushL( fs ); fs.PrivatePath( tempFilePath ); tempFilePath.Append( KTempFilename ); User::LeaveIfError( tempFile.Create( fs, tempFilePath, EFileShareExclusive | EFileWrite)); CleanupClosePushL(tempFile); // write something to tempFile CleanupStack::PopAndDestroy(); // tempFile CleanupStack::PopAndDestroy(); // fs
Usually the private folder will be created during installation if an application installs, for example, a backup registration file “backup_registration.xml”. Otherwise, RFs::CreatePrivatePath(…) can be used to explicitly create the private folder at run time.
Any files created outside the private folder have to be removed as well, provided that the name and location of the files can be determined. An application can leave user-created content on a device if the user selects to keep the files. To implement such behavior, an application with a confirmation dialog could be launched on uninstall using the FILERUN option in the package file. The confirmation application would ask the user whether to remove user-created files and then remove them afterward. See the SDK Help for more information about FILERUN in the package file format description.
Note that if the application creates a folder to the Application menu in which the application is installed, the folder is not removed. This is an S60 platform feature and therefore accepted. However, it is recommended to install applications to the default folder.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PC Suite error: (Code: Init IMediaControl2) HELP?! | chunkyspudmonkey | General Discussion | 29 | 2008-06-30 11:47 |
| Port C/C++ DLL to s60 | AndreBotelho | General Symbian C++ | 9 | 2008-08-15 20:00 |
| Local variable define | fengwenbo | Mobile Java General | 1 | 2006-09-21 13:32 |
| App to remove itself | rbwilliams2 | General Symbian C++ | 6 | 2006-11-21 09:46 |
| Uninstall Self | kdurga | General Symbian C++ | 5 | 2008-07-04 08:02 |
