How to find out full path of current 'Xcode Project' when building?

Hi, I am trying to make an iOS app with Xcode.

I want to create text files to the same path of ‘Xcode project folder’ by coding.

When I use ofDirectory or NSFileManager, I could only get the path of iOS Simulator.

What I want is… whenever I run a project, I want to know the path of the ‘Xcode project folder’ not path of ‘iOS Simulator’.

Is there any easy way to do this?

The Xcode project’s SRCROOT is most relevant at compile-time, could these text files not be copied into the usual bin/data and copied as resources into your application? iOS applications run within a sandbox so unless these files are copied into it, they will be inaccessible.

Thank you Pizthewiz!!

The reason I’m trying to write text files to Xcode project is because I want to re-use the text files that are written by iOS Simulator when l later run on a device as well.

So, my idea is, when I firstly run a Simulator, I want to write text files to SRCROOT which is Xcode’s project path. Then when I run the project through device, I would like to copy those text files to device’s Document folder so It can access to those files.