Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Where to store global prefs?

Where to store global prefs?
Thread Tools
Fresh-Faced Recruit
Join Date: Feb 2001
Location: Moscow, Russia
Status: Offline
Reply With Quote
Jun 18, 2001, 07:25 AM
 
I need my game app to store a set of user-independent data, specifically hi scores. I know it's senseless to keep them in the current user's domain since hi scores should be shared among all the users. I could store them in the application bundle, but I'm afraid it's an awkward solution. Another place is /Library/Preferences/, but I don't know how to ensure that the data will be written there and not into ~/Library/Preferences.

Does anybody know the solution Apple would recommend?

Thank you.
Make no assumptions
     
Senior User
Join Date: Mar 2000
Location: Ithaca, NY
Status: Offline
Reply With Quote
Jun 20, 2001, 03:16 PM
 
You might try /Library/Application Support/. It appears that all the permissions on the directory are set on with a default install, so it should be safe to just go ahead and create your high score file in that directory and write the scores there. Do check for errors, though, of course.
     
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
Jun 20, 2001, 07:26 PM
 
I have a related question.

Is there a simple way to traverse the Library 'hierarchy' when looking for resources? For example, the screen saver application searches in <font face = "courier">~/Library/Screen Savers</font>, <font face = "courier">/Library/Screen Savers</font>, and <font face = "courier">/System/Library/Screen Savers</font> when looking for .saver bundles. I assume it looks in <font face = "courier">/Network/Library</font> as well.

Let's say I want to do something similar for "Sound Sets" instead of "Screen Savers". Is there a convenience method for searching through the Library folders or do I have to do it by hand with hard-coded paths?
     
Dedicated MacNNer
Join Date: Feb 2001
Status: Offline
Reply With Quote
Jun 20, 2001, 11:32 PM
 
NSSearchPathForDirectoriesInDomains(NSLibraryDirec tory, NSAllDomainsMask, YES) will give you /System/Library, /Library, ~/Library, and /Network/Library
     
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status: Offline
Reply With Quote
Jun 21, 2001, 12:16 AM
 
Excellent.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:21 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2