Let’s say I have a file that’s been pre-populated with a bunch of data. I’d like this file included in the the documents directory on the device so I can read it. If I have a file in my Corona project directory it doesn’t show up in the sandbox. (When tested in the simulator and you go to the corona simulator/app name/documents directory.
Your files in the folder with your main.lua is the system.ResourceDirectory. If it’s something you need in system.DocumentsDirectory because you’re going to be updating it, your app will need to detect if it’s a first run (i.e. that file doesn’t exist in system.DocumentsDirectory, and you will have to write a little file copy function by reading the file in from system.ResourceDirectory and then writing it out to system.DocumentsDirectory.
Oh, Android might have some restrictions on this because of how the .APK is constructed. We extract some files from the .APK (a .ZIP file in reality, but not all of them. See this blog post:
http://www.coronalabs.com/blog/2012/09/26/faq-wednesday-ios-builds-api-docs-and-android/
About which files are not auto-extracted. As long as your file that you want to copy is not one of those file types, you should be good to go.
Thanks Rob. I had a bit of a brain fart. We’re all good now.
Your files in the folder with your main.lua is the system.ResourceDirectory. If it’s something you need in system.DocumentsDirectory because you’re going to be updating it, your app will need to detect if it’s a first run (i.e. that file doesn’t exist in system.DocumentsDirectory, and you will have to write a little file copy function by reading the file in from system.ResourceDirectory and then writing it out to system.DocumentsDirectory.
Oh, Android might have some restrictions on this because of how the .APK is constructed. We extract some files from the .APK (a .ZIP file in reality, but not all of them. See this blog post:
http://www.coronalabs.com/blog/2012/09/26/faq-wednesday-ios-builds-api-docs-and-android/
About which files are not auto-extracted. As long as your file that you want to copy is not one of those file types, you should be good to go.
Thanks Rob. I had a bit of a brain fart. We’re all good now.