NSHomeDirectory?


#1

In our c helper function wouldn’t it be just as easy to use something like:

NSString *documentsPath = [NSHomeDirectory() stringByAppendingPathComponent:@"/Documents/data.td"]; return documentsPath;

rather than messing around with an array?


#2

Yes, that works, but it is not the Apple-approved way. It is better to ask for the document directories and take the first one. (After all, Apple could rename the directories.)


#3

Thanks Aaron!


#4

Ah, so that’s why the data file ended up in a “Document” directory when the function clearly doesn’t specify that?

When you say “Apple could rename the directories”, are we to believe that there is some metadata with these directories or is it hard-coded somewhere in the frameworks that identify “Document” directories?

  • just curious

#5

It is hard-coded in the libraries, but it could change with a new release of the operating system. (I don’t think it would, but Apple has surprised me before…)