mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 21:30:19 -06:00
Android: Add content provider support to File::Delete
This commit is contained in:
@ -58,3 +58,10 @@ int OpenAndroidContent(const std::string& uri, const std::string& mode)
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
bool DeleteAndroidContent(const std::string& uri)
|
||||
{
|
||||
JNIEnv* env = IDCache::GetEnvForThread();
|
||||
return env->CallStaticBooleanMethod(IDCache::GetContentHandlerClass(),
|
||||
IDCache::GetContentHandlerDelete(), ToJString(env, uri));
|
||||
}
|
||||
|
@ -13,3 +13,4 @@ jstring ToJString(JNIEnv* env, const std::string& str);
|
||||
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array);
|
||||
|
||||
int OpenAndroidContent(const std::string& uri, const std::string& mode);
|
||||
bool DeleteAndroidContent(const std::string& uri);
|
||||
|
@ -41,6 +41,7 @@ static jmethodID s_compress_cb_run;
|
||||
|
||||
static jclass s_content_handler_class;
|
||||
static jmethodID s_content_handler_open_fd;
|
||||
static jmethodID s_content_handler_delete;
|
||||
|
||||
namespace IDCache
|
||||
{
|
||||
@ -187,6 +188,11 @@ jmethodID GetContentHandlerOpenFd()
|
||||
return s_content_handler_open_fd;
|
||||
}
|
||||
|
||||
jmethodID GetContentHandlerDelete()
|
||||
{
|
||||
return s_content_handler_delete;
|
||||
}
|
||||
|
||||
} // namespace IDCache
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -259,6 +265,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
s_content_handler_class = reinterpret_cast<jclass>(env->NewGlobalRef(content_handler_class));
|
||||
s_content_handler_open_fd = env->GetStaticMethodID(s_content_handler_class, "openFd",
|
||||
"(Ljava/lang/String;Ljava/lang/String;)I");
|
||||
s_content_handler_delete =
|
||||
env->GetStaticMethodID(s_content_handler_class, "delete", "(Ljava/lang/String;)Z");
|
||||
|
||||
return JNI_VERSION;
|
||||
}
|
||||
|
@ -43,5 +43,6 @@ jmethodID GetCompressCallbackRun();
|
||||
|
||||
jclass GetContentHandlerClass();
|
||||
jmethodID GetContentHandlerOpenFd();
|
||||
jmethodID GetContentHandlerDelete();
|
||||
|
||||
} // namespace IDCache
|
||||
|
Reference in New Issue
Block a user