Skip to content

Commit

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

AAsset* OpenAndroidAsset(const char* path) {
if (!IsAndroidAssetPath(path) || g_asset_manager == NULL) {
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) {
errno = ENOENT;
}
return result;
}

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

0 comments on commit a9f4844

Please sign in to comment.