I have an entire folder that I would like to be in the R.raw folder so that it looks like this:
raw/thor/myfirstfile.jpg
raw/thor/mysecondfile.m4a
raw/thor/mythirdfile.json
raw/batman/myfirstfile.jpg
raw/batman/mysecondfile.m4a
raw/batman/mythirdfile.json
So that I could copy the folders to:
/externalSD/.../themes/thor/myfirstfile.jpg
/externalSD/.../themes/thor/mysecondfile.m4a
/externalSD/.../themes/thor/mythirdfile.json
/externalSD/.../themes/batman/myfirstfile.jpg
/externalSD/.../themes/batman/mysecondfile.m4a
/externalSD/.../themes/batman/mythirdfile.json
I cannot put the folder into R.assets because the project containing these assets is a library and I need to access the files from the application project.
It's also not an option to simple put all the files into the raw/assets/drawable/etc directory because the themes are essentially templates designed to search a directory on the SD card, the idea is that more themes can be downloaded.
At present my solution is packaging the folders into zip files as such:
raw/thor.zip
raw/batman.zip
Accessing them using:
InputStream fileStream = context.getResources().openRawResource(rawResource);
and then unzipping on the first run of the app onto the SD card - but it is painfully slow. It would (hopefully) be much quicker to simply copy a folder rather than unzip one.
My question is how can I copy an entire folder out of the R.raw resources?