Issue
I'm building an application that is targeting Windows, Mac and Linux soon. I was wondering where should I keep application data such as settings, etc.
Application's installation folder is the easiest choice, but I think that might be a problem with new Vista security model. Besides, users might want different settings.
Is it C:\Documents and Settings\username\MyApp good for both Vista and XP? Is it /home/username/.MyApp good for Linux and Macs?
Any ideas and/or links to best practices much appreciated.
Thanks!
Juan
Solution
Each platform has its own API for finding the user's home folder, or documents folder, or preferences folder.
- Windows: SHGetFolderPath() or SHGetKnownFolderPath()
- Mac OS X and iPhone OS: NSSearchPathForDirectoriesInDomains()
- Unix: $HOME environment variable
Don't hardcode specific paths or just tack a prefix and suffix on the user's name. Also, try to follow whatever conventions there are for the platform for naming the files.
Answered By - Kristopher Johnson Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.