I am trying to understand how to create my own directory tree and access it from my application.
I am doing some kind of learning program and want to create a directory structure like this:
-MyLessonsDirectory
--LessonDirectory_1
---Step_1
---Step_2
---Step_3
--LessonDirectory_2
---Step_1
---Step_2
---Step_3
.
.
and so on
In each “Step”-directory I will have specific content for that step of the lesson. The content is added by me while developing. Hence, I don’t want to create the structure and content from within the application, just access it and reading the content of the directories. If I can create this kind of structure and use it it will be very easy to create a nice design that makes it easy to create new lessons in my app.
What I cannot figure out is where I should create those directories in the file-structure in xCode and what is the path to those directories from my application.
On the iPhone, you only have access to the apps own directories. The best place to put practice directories in the Documents folder in the app directory.
This…
… gives you the path to the directory folder which you can then hand off to the NSFileManager.
If you want to see the directory structure visually, run the app on the simulator and look in
The app will be in one of the folders with the gibberish UUID name. You can see the directories and files there in the Finder.
I would add that the iPhone already has most of the directories you might practically need. You have preferences, cache, tmp, Documents etc all in place.
Edit01:
You cannot alter the default directory structure and you have absolutely no control over how the application or its directories are installed. iPhone apps do not have external support files of any kind. Every thing is inside the app bundle.
However, the app bundle is really just a directory so you can stuff things inside it and copy them out into one of the default directories the first time the app runs. You can write anything you want to the documents directory.