alex
alex

Reputation: 879

xcode file path

My question is very simple, I have a text file that I put in the folder "other sources" in Xcode, and I want a use this text file in my program but I don't know what is his file path.

Upvotes: 1

Views: 1843

Answers (1)

Brian
Brian

Reputation: 15706

If the file is in an Xcode group and not a referenced directory, then it will be placed in the root of the app's main bundle. So if you're trying to get at foo.txt, you can access it like this:

[[NSBundle mainBundle] pathForResource:@"foo" ofType:@"txt"];

Upvotes: 1

Related Questions