• 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: Jesse Wesson <email@hidden>
  • Date: Thu, 4 May 2006 13:10:15 -0700

I was hoping to insert the environment variables between NSArgumentDomain and the application domain. Is this no longer possible with the removal of -searchList and -setSearchList:?

Jesse


On May 1, 2006, at 9:43 am, Chris Parker wrote:


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: Chris Parker <email@hidden>
References: 
 >Re: NSUserDefaults and using volatile domains (From: Chris Parker <email@hidden>)

  • Prev by Date: Whitespace
  • Next by Date: Re: NSUserDefaults and using volatile domains
  • Previous by thread: Re: NSUserDefaults and using volatile domains
  • Next by thread: Re: NSUserDefaults and using volatile domains
  • Index(es):
    • Date
    • Thread