• 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: NSUserDefaults and using volatile domains
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaults and using volatile domains


  • Subject: Re: NSUserDefaults and using volatile domains
  • From: Chris Parker <email@hidden>
  • Date: Mon, 1 May 2006 09:43:58 -0700


On Apr 29, 2006, at 10:11 AM, Jesse Wesson wrote:

I would like to add a volatile domain (the process’ environment variables) to the search path of my command line tool’s user defaults. Once I add the dictionary though, all the keys return nil (code snippet below). Once a volatile domain is added, is it not included to the search path?

Jesse


[[NSUserDefaults standardUserDefaults] setVolatileDomain: [[NSProcessInfo processInfo] environment] forName:@"EnvironmentVariableDomain"];
NSString *path = [[NSUserDefaults standardUserDefaults] objectForKey:@"PATH"];
NSLog( @"PATH=%@", path );

-setVolatileDomain:forName: only associates a dictionary with the name in the NSUserDefaults object - it does not add it to the search path.


Is there a particular reason you'd like to do this? -[NSProcessInfo environment] is the correct way to pick up the environment variables. If you absolutely must have them in your search path, you could use - [NSUserDefaults registerDefaults:] with the dictionary returned from - [NSProcessInfo environment], but that's the best you could do.

.chris

--
Chris Parker
Cocoa Frameworks
Apple Computer, Inc.


_______________________________________________ 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: NSUserDefaults and using volatile domains
      • From: Jesse Wesson <email@hidden>
  • Prev by Date: Re: Animated split view collapsing
  • Next by Date: Re: First day of the week? Which one?
  • Previous by thread: Re: Animated split view collapsing
  • Next by thread: Re: NSUserDefaults and using volatile domains
  • Index(es):
    • Date
    • Thread