|
@@ -1890,14 +1890,6 @@ bool Android_JNI_GetAssetPathInfo(const char *path, SDL_PathInfo *info)
|
|
}
|
|
}
|
|
|
|
|
|
// this is sort of messy, but there isn't a stat()-like interface to the Assets.
|
|
// this is sort of messy, but there isn't a stat()-like interface to the Assets.
|
|
- AAssetDir *adir = AAssetManager_openDir(asset_manager, path);
|
|
|
|
- if (adir) { // it's a directory!
|
|
|
|
- AAssetDir_close(adir);
|
|
|
|
- info->type = SDL_PATHTYPE_DIRECTORY;
|
|
|
|
- info->size = 0;
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
AAsset *aasset = AAssetManager_open(asset_manager, path, AASSET_MODE_UNKNOWN);
|
|
AAsset *aasset = AAssetManager_open(asset_manager, path, AASSET_MODE_UNKNOWN);
|
|
if (aasset) { // it's a file!
|
|
if (aasset) { // it's a file!
|
|
info->type = SDL_PATHTYPE_FILE;
|
|
info->type = SDL_PATHTYPE_FILE;
|
|
@@ -1906,6 +1898,17 @@ bool Android_JNI_GetAssetPathInfo(const char *path, SDL_PathInfo *info)
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ AAssetDir *adir = AAssetManager_openDir(asset_manager, path);
|
|
|
|
+ if (adir) { // This does _not_ return NULL for a missing directory! Treat empty directories as missing. Better than nothing. :/
|
|
|
|
+ const bool contains_something = (AAssetDir_getNextFileName(adir) != NULL); // if not NULL, there are files in this directory, so it's _definitely_ a directory.
|
|
|
|
+ AAssetDir_close(adir);
|
|
|
|
+ if (contains_something) {
|
|
|
|
+ info->type = SDL_PATHTYPE_DIRECTORY;
|
|
|
|
+ info->size = 0;
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return SDL_SetError("Couldn't open asset '%s'", path);
|
|
return SDL_SetError("Couldn't open asset '%s'", path);
|
|
}
|
|
}
|
|
|
|
|