Commit 5d0d5b5d authored by Max Kellermann's avatar Max Kellermann

Android/Context: allow type=nullptr in GetExternalFilesDir()

parent 1aa3c1e5
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment