Re: NSArray init with a path
Re: NSArray init with a path
- Subject: Re: NSArray init with a path
- From: Scott Herz <email@hidden>
- Date: Thu, 21 Jun 2001 14:11:40 -0700
What happens if you resave your file in the plist editor? Does it work
after plist editor appends the encoding/dtd/version goop at the top?
Scott.
On Thursday, June 21, 2001, at 12:10 PM, Jason Brown wrote:
Ok, given a file setup like the following:
<array>
<string> string information here </string>
<string> more info </string>
.
.
.
<string> last one </string>
</array>
I had hoped that the following code would work: (given that masterList
is NSArray type and the file does exist at that location)
NSString *dataPath = [NSHomeDirectory()
stringByAppendingPathComponent:@"Documents/books.dat"];
masterList = [[NSArray alloc] initWithContentsOfFile:dataPath];
Since this doesnt work, I am obviously missing something. Is there a
better way to format the file? Is there a different init method I
should use?
Secondary question, is there any equivalent method to NSHomeDirectory()
that would return the path to the directory that the app is running
in? Ala NSAppDirectory()?
Thanks.
Jason Brown
Vital Source Technologies
-- _______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev