Re: Saving to the home folder
Re: Saving to the home folder
- Subject: Re: Saving to the home folder
- From: April Gendill <email@hidden>
- Date: Wed, 13 Aug 2003 00:17:01 -0700
Actually... I was chasing this all wrong.
I finally found the info I needed here:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSFileManager.html
I was searching for the wrong thing, and when I saw the NSHomeDirectory
in PathUtilities I missed the (void) at the end of it, so thanks guys,
but I got it working.
On Wednesday, August 13, 2003, at 12:10 AM, Nicholas Riley wrote:
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.