Issue
I wonder how to make file hierarchy of assets folder in Android from native code. I'm using AAssetManager_openDir
but AAssetDir_getNextFileName
doesn't return any directory names so basically I have no way to dive deeper into hierarchy because I can't obtain names of subfolders. Is there any way to resolve this issue with AAssetManager
or should I implement this in Java?
Example
Assets looks like
a/
file1
file2
b/
file3
c/
file4
C++ code
AAssetDir* assetDir = AAssetManager_openDir(env, "");
// filename is NULL since there is only folders at the root folder
const char* filename = AAssetDir_getNextFileName(assetDir);
AAssetDir_close(assetDir);
AAssetDir* assetDir = AAssetManager_openDir(env, "a");
// filename is "file1"
const char* filename = AAssetDir_getNextFileName(assetDir);
// filename is "file2"
filename = AAssetDir_getNextFileName(assetDir);
AAssetDir_close(assetDir);
EDIT:
I found out that AAssetDir_getNextFileName
implementation literally filters directories from output.
Link to source code