Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set errno if fail to open file from Android asset manager #4387

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
jonastsai marked this conversation as resolved.
Show resolved Hide resolved
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);
jonastsai marked this conversation as resolved.
Show resolved Hide resolved
if (!result) {
SB_LOG(WARNING) << "Unable to open from Android Asset Manager: " << path;
errno = ENOENT;
}
return result;
}

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