Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
How to remove locally created files during uninstall
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).
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” );
User::LeaveIfError( fs.Connect() );
CleanupClosePushL( fs );
fs.PrivatePath( tempFilePath );
tempFilePath.Append( KTempFilename );
User::LeaveIfError( tempFile.Create( fs, tempFilePath, EFileShareExclusive | EFileWrite));
// 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.