mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 06:18:32 +00:00
Android: Add content provider support to File::IOFile
Taking the hit now to prepare us for when Google Play will force us to use scoped storage...
This commit is contained in:
parent
d9f3e382fe
commit
6e1e6d2311
10 changed files with 114 additions and 5 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <jni.h>
|
||||
|
||||
#include "Common/StringUtil.h"
|
||||
#include "jni/AndroidCommon/IDCache.h"
|
||||
|
||||
std::string GetJString(JNIEnv* env, jstring jstr)
|
||||
{
|
||||
|
@ -40,3 +41,20 @@ std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
int OpenAndroidContent(const std::string& uri, const std::string& mode)
|
||||
{
|
||||
JNIEnv* env = IDCache::GetEnvForThread();
|
||||
const jint fd = env->CallStaticIntMethod(IDCache::GetContentHandlerClass(),
|
||||
IDCache::GetContentHandlerOpenFd(), ToJString(env, uri),
|
||||
ToJString(env, mode));
|
||||
|
||||
// We can get an IllegalArgumentException when passing an invalid mode
|
||||
if (env->ExceptionCheck())
|
||||
{
|
||||
env->ExceptionDescribe();
|
||||
abort();
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue