Question
I need to save files in the Tizen file system that meet two requirements:
- The files should persist after app reinstallation
- The files should be visible and accessible through Tizen Device Manager
I've tried using app_get_data_path(), but it returns /opt/usr/home/owner/apps_rw/org.example.app/data/ which gets deleted on reinstall and isn't visible in Device Manager. I also tried /opt/usr/media/Others/ but this location isn't visible in Device Manager either.
What is the proper directory to use for files that persist through app reinstalls and are accessible via Device Manager?
Answer
Problem Understanding
The user needs to store files that:
- Persist after app reinstallation
- Are visible in Tizen Device Manager
- Can be accessed by other applications
Solution Methods
-
Using app_get_shared_data_path()
- Returns path:
/opt/usr/home/owner/apps_rw/[app_id]/shared/data/ - Files can be read by other apps
- Not visible in Device Manager
- Not persistent after uninstall
- Returns path:
-
Using Media Storage Directories
- Recommended path:
/opt/usr/home/owner/media/Documents/ - Files persist after app reinstallation
- Visible in Device Manager
- Accessible by other apps
- Recommended path:
-
Alternative Media Paths
- For Tizen 3.0+:
/home/owner/media/ - For older versions:
/opt/usr/home/owner/media/
- For Tizen 3.0+:
Code Examples
// To get shared data path (not persistent)
char* shared_path = NULL;
app_get_shared_data_path(&shared_path);
// To use persistent media directory
const char* persistent_path = "/opt/usr/home/owner/media/Documents/";
Additional Tips
- Device Manager requires directories to have Write permission for Other users
- For file operations, use proper error handling
- Consider security implications when storing files in shared locations
- Test paths on different Tizen versions as directory structures may vary