Skip to content

Commit

Permalink
Set errno if fail to open file from Android asset manager (#4387)
Browse files Browse the repository at this point in the history
b/377488323
  • Loading branch information
jonastsai authored Nov 12, 2024
1 parent 87f2a2c commit 8c29bde
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion starboard/android/shared/file_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,17 @@ bool IsAndroidAssetPath(const char* path) {

AAsset* OpenAndroidAsset(const char* path) {
if (!IsAndroidAssetPath(path) || g_asset_manager == NULL) {
SB_LOG(WARNING) << "Unable to open from Android Asset Manager: " << path;
errno = ENOENT;
return NULL;
}
const char* asset_path = path + strlen(g_app_assets_dir) + 1;
return AAssetManager_open(g_asset_manager, asset_path, AASSET_MODE_RANDOM);
AAsset* result = AAssetManager_open(g_asset_manager, asset_path, AASSET_MODE_RANDOM);
if (!result) {
SB_LOG(WARNING) << "Unable to open from Android Asset Manager: " << path;
errno = ENOENT;
}
return result;
}

AAssetDir* OpenAndroidAssetDir(const char* path) {
Expand Down

0 comments on commit 8c29bde

Please sign in to comment.