How do you get a file into the sandbox's "Documents" directory?

I’ve got some text files that my app will be reading from containing information necessary to the function of the program. I’ve created these files using a text editor, and now need to open them on startup of the app. However, when I run the project, these files aren’t copied anywhere in the sandbox folder. Is there a way to include these files in the buildsettings or config file to have the simulator, and more importantly the compiler, into the directory? [import]uid: 213270 topic_id: 34914 reply_id: 334914[/import]

Hi Mike,
You can see the folder by selecting “File > show project sandbox” in he Simulator. That should open up a window with a list of your various Corona project folders. Open the one you need, then open “Documents”. That is the folder where your device reads its local documents from (and it will be mimicked in the Simulator).

If these are text files that you have created in advance and you want to read from, like a list of info or some content, you should just place those in your project directory (they can be in a subfolder) and access them as you would any other file like an image or sound file.

Hope this answers your question,
Brent [import]uid: 200026 topic_id: 34914 reply_id: 138764[/import]

Also, if you want your users to edit the document, you can add UIFileSharingEnabled = true to your build.settings file in the plist section for iPhone.
This will enable your users to use iTunes to copy over new data to the Documents directory.
(Note: UIFileSharingEnabled only works for iOS, not Android)

You could have a folder named ‘sampledata’ in your Resource directory where you put the default documents, and on first launch copy the documents from the sampledata folder to the Documents directory of the app. [import]uid: 70847 topic_id: 34914 reply_id: 138772[/import]

Hi Mike,
You can see the folder by selecting “File > show project sandbox” in he Simulator. That should open up a window with a list of your various Corona project folders. Open the one you need, then open “Documents”. That is the folder where your device reads its local documents from (and it will be mimicked in the Simulator).

If these are text files that you have created in advance and you want to read from, like a list of info or some content, you should just place those in your project directory (they can be in a subfolder) and access them as you would any other file like an image or sound file.

Hope this answers your question,
Brent [import]uid: 200026 topic_id: 34914 reply_id: 138764[/import]

Also, if you want your users to edit the document, you can add UIFileSharingEnabled = true to your build.settings file in the plist section for iPhone.
This will enable your users to use iTunes to copy over new data to the Documents directory.
(Note: UIFileSharingEnabled only works for iOS, not Android)

You could have a folder named ‘sampledata’ in your Resource directory where you put the default documents, and on first launch copy the documents from the sampledata folder to the Documents directory of the app. [import]uid: 70847 topic_id: 34914 reply_id: 138772[/import]