PDL_GetDataFilePath
NOTE:
We would like to thank our users for bringing to our attention a bug in the initial release of webOS 1.4.5: this API returns a location that is not writable. This also applies to apps that are trying to save data to a location in /media/internal/. We apologize if this issue affects your app.
As a workaround, you can save preference and configuration data in your app's directory. Your app can do this by writing to a file with no relative path. Any files and folders created there are not visible to the user and are preserved when your app is upgraded. However, if the user deletes your app from the device, they are removed, unlike those in the location returned from this API.
This issue will be resolved in the next OS release.
Description
Use this function to get a location for saving application data. Given a file name, this function sets buffer to an absolute path (including the file name) where the file can be safely stored. This location is segregated from the application's installed files, allowing you to replace or remove the application without destroying the data files it generates.
The path is set in the buffer parameter, which you should allocate with enough memory (256 bytes recommended) to contain a long path. Set bufferLen to the length of the buffer.
Once you have your location, you can use standard C/C++ input/output functions for saving and retrieving data.
Syntax
PDL_Err PDL_GetDataFilePath(const char *dataFileName, char *buffer, int bufferLen);
Argument | Description |
---|---|
dataFileName | Name of the data file which needs a save location. |
buffer | Pointer to the buffer. |
bufferLen | Length of the buffer. |
Returns
PDL_INVALIDINPUT — buffer is NULL or its length is less than or equal to zero or dataFileName is NULL. PDL_STRINGTOOSMALL — Passed buffer is too small to hold value. PDL_NOERROR — Success.