android/Environment: pass JNIEnv to all functions

This commit is contained in:
Max Kellermann
2022-08-18 18:07:29 +02:00
parent 2efc1db6a9
commit 1f4df2a64d
4 changed files with 9 additions and 12 deletions

View File

@@ -51,10 +51,8 @@ Deinitialise(JNIEnv *env) noexcept
}
AllocatedPath
getExternalStorageDirectory() noexcept
getExternalStorageDirectory(JNIEnv *env) noexcept
{
JNIEnv *env = Java::GetEnv();
jobject file =
env->CallStaticObjectMethod(cls,
getExternalStorageDirectory_method);
@@ -65,14 +63,12 @@ getExternalStorageDirectory() noexcept
}
AllocatedPath
getExternalStoragePublicDirectory(const char *type) noexcept
getExternalStoragePublicDirectory(JNIEnv *env, const char *type) noexcept
{
if (getExternalStoragePublicDirectory_method == nullptr)
/* needs API level 8 */
return nullptr;
JNIEnv *env = Java::GetEnv();
Java::String type2(env, type);
jobject file = env->CallStaticObjectMethod(cls,
getExternalStoragePublicDirectory_method,