| 107 | } |
| 108 | |
| 109 | Result GetApplicationPath(char* path_out, uint32_t path_len) |
| 110 | { |
| 111 | dmAndroid::ThreadAttacher thread; |
| 112 | JNIEnv* env = thread.GetEnv(); |
| 113 | if (!env) |
| 114 | { |
| 115 | return RESULT_UNKNOWN; |
| 116 | } |
| 117 | |
| 118 | jclass activity_class = env->FindClass("android/app/NativeActivity"); |
| 119 | jmethodID get_files_dir_method = env->GetMethodID(activity_class, "getFilesDir", "()Ljava/io/File;"); |
| 120 | jobject files_dir_obj = env->CallObjectMethod(thread.GetActivity()->clazz, get_files_dir_method); |
| 121 | jclass file_class = env->FindClass("java/io/File"); |
| 122 | jmethodID getPathMethod = env->GetMethodID(file_class, "getParent", "()Ljava/lang/String;"); |
| 123 | jstring path_obj = (jstring)env->CallObjectMethod(files_dir_obj, getPathMethod); |
| 124 | |
| 125 | Result res = RESULT_OK; |
| 126 | |
| 127 | if (path_obj) |
| 128 | { |
| 129 | const char* filesDir = env->GetStringUTFChars(path_obj, NULL); |
| 130 | |
| 131 | if (dmStrlCpy(path_out, filesDir, path_len) >= path_len) |
| 132 | { |
| 133 | path_out[0] = 0; |
| 134 | res = RESULT_INVAL; |
| 135 | } |
| 136 | env->ReleaseStringUTFChars(path_obj, filesDir); |
| 137 | } |
| 138 | else |
| 139 | { |
| 140 | res = RESULT_UNKNOWN; |
| 141 | } |
| 142 | return res; |
| 143 | } |
| 144 | |
| 145 | Result OpenURL(const char* url, const char* target) |
| 146 | { |
nothing calls this directly
no test coverage detected