You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
get rid of launcher script requirement; fix app data dir being hardcoded; update documentation; remove prebuilt dalvik (NOTE - purged from history at this point, so is not part of the diff)
This commit is contained in:
@@ -9,15 +9,18 @@
|
||||
#include "util.h"
|
||||
#include "generated_headers/android_content_res_AssetManager.h"
|
||||
|
||||
#define ASSET_DIR "data/assets/"
|
||||
#define ASSET_DIR "assets/"
|
||||
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);
|
||||
char *path = malloc(strlen(file_name) + strlen(ASSET_DIR) + 1);
|
||||
char *app_data_dir = get_app_data_dir();
|
||||
char *path = malloc(strlen(app_data_dir) + strlen(ASSET_DIR) + strlen(file_name) + 1);
|
||||
int fd;
|
||||
|
||||
strcpy(path, ASSET_DIR);
|
||||
strcpy(path, app_data_dir);
|
||||
strcat(path, ASSET_DIR);
|
||||
strcat(path, file_name);
|
||||
|
||||
printf("openning asset with filename: %s\n", _CSTRING(_file_name));
|
||||
|
||||
11
src/api-impl-jni/android_os_Environment.c
Normal file
11
src/api-impl-jni/android_os_Environment.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "defines.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "generated_headers/android_os_Environment.h"
|
||||
|
||||
char *get_app_data_dir();
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_android_os_Environment_native_1get_1app_1data_1dir(JNIEnv *env, jclass this)
|
||||
{
|
||||
return _JSTRING(get_app_data_dir());
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
#define _CLASS(object) ((*env)->GetObjectClass(env, object))
|
||||
#define _SUPER(object) ((*env)->GetSuperclass(env, object))
|
||||
#define _METHOD(class, method, attrs) ((*env)->GetMethodID(env, class, method, attrs))
|
||||
#define _STATIC_METHOD(class, method, attrs) ((*env)->GetStaticMethodID(env, class, method, attrs))
|
||||
#define _JSTRING(cstring) ((*env)->NewStringUTF(env, cstring))
|
||||
#define _CSTRING(jstring) ((*env)->GetStringUTFChars(env, jstring, NULL))
|
||||
#define _FIELD_ID(class, field, type) ((*env)->GetFieldID(env, class , field, type))
|
||||
|
||||
21
src/api-impl-jni/generated_headers/android_os_Environment.h
Normal file
21
src/api-impl-jni/generated_headers/android_os_Environment.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class android_os_Environment */
|
||||
|
||||
#ifndef _Included_android_os_Environment
|
||||
#define _Included_android_os_Environment
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: android_os_Environment
|
||||
* Method: native_get_app_data_dir
|
||||
* Signature: ()Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL Java_android_os_Environment_native_1get_1app_1data_1dir
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user