Re: Saving to the home folder
Re: Saving to the home folder
- Subject: Re: Saving to the home folder
- From: Stéphane Sudre <email@hidden>
- Date: Wed, 13 Aug 2003 08:53:26 +0200
You need to get the "real" path by using:
stringByExpandingTildeInPath
on your thePath parameter.
On mercredi, ao{t 13, 2003, at 08:37 AM, April Gendill wrote:
I am trying to save a file to the home folder automatically.
Mostly because I'm not having any luck reading and writing to the main
bundle.
anyway.
this is the Method I'm using but it does not write anything . If I
change the path to just the root directory it works, but not if I try
to write to the home folder or anywhere else. the method is in test
mode right now, but later there will be actual data written.
- (void)saveFile:(id)sender
{
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?
_______________________________________________
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.
_______________________________________________
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.