Re: Saving to the home folder
Re: Saving to the home folder
On Tue, Aug 12, 2003 at 11:37:44PM -0700, April Gendill wrote:
>
NSString *thePath=@"~/testFile.dict";
>
NSMutableDictionary *theDict =[[NSMutableDictionary
>
alloc]init];
>
[theDict setObject:@"Value" forKey:@"Key"];
>
[theDict writeToFile:thePath
>
atomically:YES];
>
I use a performSelector call to invoke this, although in the end it
>
will probably be -(void)saveFile:(NSDictionary *)aDictionary
>
so I can call it simply with [self saveFile]; Anyway. I must assume
>
that the way I'm entering the path is incorrect. So how do I get it to
>
write to the home folder?
You need to use [thePath stringByExpandingTildeInPath]. ~ is just a
shortcut and is not valid to the low-level file utilities.
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.