Article # 441, added by Geoworks, historical record
| first |
previous |
index |
next |
last |
How does FDocumentDir use the .INI docPath settings?
Q. How does FDocumentDir use the .INI docPath settings? A. If an application wants to store its documents in its own subdirectory below the DOCUMENT directory (as many of the Nokia applications do), it can do this with FoamSetDocumentDir. First, it must add the subdirectory name to the appDocPaths category in the ini file, so the system knows the subdirectory name. Here are the default keys within the appDocPaths category (and their corresponding FDocumentDir enum): [appDocPaths] lastDocPath = 8 docPath1 = Own texts ; FDD_CREATED_TEXTS docPath2 = Received faxes ; FDD_RECEIVED_FAXES docPath3 = Received messages ; FDD_RECEIVED_SM docPath4 = Received email ; FDD_RECEIVED_MAIL docPath5 = Standard messages ; FDD_MESSAGE_TEMPLATES docPath6 = Business cards ; FDD_BUSINESS_CARDS docPath7 = Downloaded files ; FDD_DOWNLOADED_FILES docPath8 = WWWHotlist ; FDD_WWW_HOTLIST To add your own path to this list, first your need to get the "lastDocPath" so you know the path entry number that your application will use. You should not assume the "docPath9" will be available because another application could be using it. The best thing to do is store your path number in an application specific ini category, that way your application can use whatever path number is available and it will also be able to determine if the ini file has been reset (if the user for some reason resets the device to its factory defaults). You can use InitFileReadInteger() to get lastDocPath number; increment the returned number to get the docPath number that you should use; then write the new number to lastDocPath with InitFileWriteInteger(). Remember to save the number to your application's ini file category. Finally, add your docPath to the list by creating a key that is "docPath" plus the ASCII value for your path number and write it to the ini file with InitFileWriteString. Lastly, you need to call InitFileCommit() so all your ini file modification are actually changed in the ini file. Once you've done this, you can now use FoamPathMake() or FoamPathMakeSP() to create the FoamPathHandle for the new directory. With this new handle you can use it just like a FDocumentDir enum in any of the usual foam library routines.