At 15:58 2003-1-9 -0800, you wrote:
I have a utility that auto-runs from an unlocked SD card as "/Palm/start.prc". This utility is never run on the same device twice, so I cannot rely on storing application-specific prefs on the device itself. Any such persistent values must be embedded into "/Palm/start.prc"

I need this application to present a user-modifiable preference, and to persist this information between invocations. This means I have to read/write the preference from the "/Palm/start.prc" file on the SD card, and NOT from the in-memory temporary copy of the application.

Can someone suggest a good way to do this? My options as I see them:

1) Leverage the app prefs block to contain my preference setting, via PrefGetAppPreferences() / PrefSetAppPreferences(). Then, in AppStop(), if the pref block is dirty, update the file on the SD card by first deleting "/Palm/start.prc" and then VFSExportDatabaseToFile( localPDB, "/Palm/start.prc").

2) Leverage the DataManager's AppInfo block. Read it using DmGetAppInfoID(), and update it by using VFSFileSeek() and VFSFileWrite() on "/Palm/start.prc".

I would prefer approach #2 to avoid the hassle (and overhead -- this is a very large PRC) of deletion in approach #1. For approach #2, can I safely use VFSFileSeek( myFile, vfsOriginBeginning, 0 ) to read in the DatabaseHdrType structure that is supposed to comprise the beginning of any PDB/PRC/PQA so that I may ascertain its appInfoID field, and then just seek ahead that # of bytes to find (and update) the appInfo block? I am a little hesitant to do this for fear that I might run into VFS headers that wrap the PRC and cause trouble.
Jeff, is there a reason you can't just store your own prefs file in /Palm/Programs/MySecretProgram/prefs.dat or some file like that. I think that's a lot safer and simpler than trying to write back to a PRC file on the VFS volume.

--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com

--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/


Reply via email to