Android/Context: allow type=nullptr in GetExternalFilesDir()
This commit is contained in:
parent
1aa3c1e543
commit
5d0d5b5d97
@ -44,13 +44,12 @@ Context::Initialise(JNIEnv *env) noexcept
|
||||
}
|
||||
|
||||
AllocatedPath
|
||||
Context::GetExternalFilesDir(JNIEnv *env, const char *_type) noexcept
|
||||
Context::GetExternalFilesDir(JNIEnv *env, const char *type) noexcept
|
||||
{
|
||||
assert(_type != nullptr);
|
||||
|
||||
Java::String type{env, _type};
|
||||
|
||||
jobject file = env->CallObjectMethod(Get(), getExternalFilesDir_method, type.Get());
|
||||
jobject file = env->CallObjectMethod(Get(), getExternalFilesDir_method,
|
||||
Java::String::Optional(env, type).Get());
|
||||
if (Java::DiscardException(env) || file == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
@ -36,9 +36,12 @@ public:
|
||||
Context(JNIEnv *env, jobject obj) noexcept
|
||||
:Java::GlobalObject(env, obj) {}
|
||||
|
||||
/**
|
||||
* @param type the subdirectory name; may be nullptr
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
AllocatedPath GetExternalFilesDir(JNIEnv *env,
|
||||
const char *type) noexcept;
|
||||
const char *type=nullptr) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
AllocatedPath GetCacheDir(JNIEnv *env) const noexcept;
|
||||
|
Loading…
Reference in New Issue
Block a user