misc: fix stuff up to make SDL example work again

it still behaves weirdly, should probably find some
other example since I don't trust my own code.
This commit is contained in:
Mis012
2023-10-29 22:47:57 +01:00
parent 9025142bdd
commit 0b0cfed345
8 changed files with 25 additions and 11 deletions

View File

@@ -15,6 +15,11 @@ char *get_app_data_dir();
JNIEXPORT jint JNICALL Java_android_content_res_AssetManager_openAsset(JNIEnv *env, jobject this, jstring _file_name, jint mode)
{
const char *file_name = _CSTRING(_file_name);
/* handle absolute paths */
if(file_name[0] == '/')
return open(file_name, O_CLOEXEC | O_RDWR);
char *app_data_dir = get_app_data_dir();
char *path = malloc(strlen(app_data_dir) + strlen(ASSET_DIR) + strlen(file_name) + 1);
int fd;