Pergunta

My application has two sources of data: standard assets folder and downloaded file. Now I access assets (from C++ code) using AAssetManager_open, AAsset_read etc. And I read data from downloaded file using good old fopen, fread etc. Is it possible to access all the data in unified way using fopen, fread stuff? In other words, can I change

AAssetManager* assetManager = g_state->activity->assetManager;
AAsset* asset = AAssetManager_open(assetManager, filename, AASSET_MODE_UNKNOWN);
int ret = AAsset_read(asset, buf, size);

to

char *filenameFull = SomehowGetFullPathToAssetsFile(filename);
FILE *fp = fopen(filenameFull, "rb");
int ret = fread(buf, size, 1, fp);
Foi útil?

Solução

Short answer: No.

Long answer: No, you can't access them in an unified way because because assets lay in your APK file and not on ordinary file system. One workaround might be to extracting your resources to file system in a setup/initialization phase then use them from there afterwards.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top