Android assets improvements to support directories

- Extend NSBundle resources support to handle directories in Android assets.
- Fix NSFileManager -isReadableFileAtPath: to also support directories in Android assets.
This commit is contained in:
Frederik Seiffert 2020-05-19 16:07:02 +02:00
parent 4dd9fa30ab
commit db19fc3308
3 changed files with 35 additions and 3 deletions

View file

@ -1806,8 +1806,8 @@ static NSStringEncoding defaultEncoding;
{
#ifdef __ANDROID__
/* Android: try using asset manager if path is in
* main bundle resources
*/
* main bundle resources
*/
AAsset *asset = [NSBundle assetForPath: path];
if (asset)
{
@ -1877,13 +1877,22 @@ static NSStringEncoding defaultEncoding;
}
#ifdef __ANDROID__
// Android: try using asset manager if path is in main bundle resources
/* Android: try using asset manager if path is in
* main bundle resources
*/
AAsset *asset = [NSBundle assetForPath: path];
if (asset)
{
AAsset_close(asset);
return YES;
}
AAssetDir *assetDir = [NSBundle assetDirForPath: path];
if (assetDir)
{
AAssetDir_close(assetDir);
return YES;
}
#endif
return NO;