• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Best way of getting /Library/Preferences paths?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best way of getting /Library/Preferences paths?


  • Subject: Re: Best way of getting /Library/Preferences paths?
  • From: Andreas Mayer <email@hidden>
  • Date: Sat, 18 Sep 2004 11:20:18 +0200


Am 18.09.2004 um 10:22 Uhr schrieb Christoffer Lerno:

Now I could simply hardcode these strings, but if there is some better way of accessing these folders then I suppose that would be better.


- (NSString *)findSystemFolderType:(int)folderType forDomain:(int)domain
{
	FSRef folder;
	OSErr err = noErr;
	CFURLRef url;
	NSString *result = nil;

	err = FSFindFolder(domain, folderType, false, &folder);

	if (err == noErr) {
		url =  CFURLCreateFromFSRef(kCFAllocatorDefault, &folder);
		result = [(NSURL *)url path];
	}

	return result;
}

Folder types are declared in Folders.h. In this case you would use kPreferencesFolderType.

~/Library/Preferences would be in kUserDomain, /Library/Preferences in kLocalDomain, I guess.


Andreas

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Best way of getting /Library/Preferences paths?
      • From: Finlay Dobbie <email@hidden>
References: 
 >Best way of getting /Library/Preferences paths? (From: Christoffer Lerno <email@hidden>)

  • Prev by Date: Re: Best way of getting /Library/Preferences paths?
  • Next by Date: Re: Best way of getting /Library/Preferences paths?
  • Previous by thread: Re: Best way of getting /Library/Preferences paths?
  • Next by thread: Re: Best way of getting /Library/Preferences paths?
  • Index(es):
    • Date
    • Thread