Re: NSUserDefaults and using volatile domains
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