The spec shows that there is only a function for iterating over files, not directories. This either means that the developers using the NDK can't query the asset manager for directories; at least not on my device. Or that it only works on some devices (not on 8.0.0 s7 edge). I'd recommend adding AAssetDir_getNextFolderName, requiring AAssetDir_getNextFileName to display directories as well as assets or providing a function to loop over all files in the assets dir (nested).
AAssetManager *assetManager = ((android_app*)param)->activity->assetManager; AAssetDir *dir = AAssetManager_openDir(assetManager, path); Log::println(String((void*)dir)); const char *name = nullptr; while ((name = AAssetDir_getNextFileName(dir)) != nullptr) { Log::println(String("res/") + name); } AAssetDir_close(dir);
Doesn't do anything for path = "" or "res" (assets/res; a directory with only directories), but when I pass in a directory with files "res/shaders" (assets/res/shaders) it does work.
AssetDir supports this, why is this removed by AAssetManager?
I posted this issue on Github too; which got the following response:
"this needs some digging into the history and not sure what will be outcome either:
// Find the next regular file; explicitly don't report directories even if the
// underlying implementation changes to report them. At that point we can add
// a more general iterator to this native interface set if appropriate.
while ((index < max) && (assetDir->mAssetDir->getFileType(index) != kFileTypeRegular)) {
index++;
}
How about post this question to https://groups.google.com/forum/#!forum/android-ndk?"
I would be great if this could be considered for a future release.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/41f7e968-4ffb-4b0a-822e-9bfc9ce2ebb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "android-ndk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-ndk/77OGvoeXN34/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/CAFVaGhtkN1BpnLM6pKfe-N6gSd--ZE2NFFLXUYPZkgyerjkagA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/82264449-B8E3-43F7-B648-5269442C3823%40algoriddim.com.