mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Android: Add content provider support to File::ScanDirectoryTree
This commit is contained in:
@ -121,6 +121,15 @@ std::string GetAndroidContentDisplayName(const std::string& uri)
|
||||
return display_name ? GetJString(env, reinterpret_cast<jstring>(display_name)) : "";
|
||||
}
|
||||
|
||||
std::vector<std::string> GetAndroidContentChildNames(const std::string& uri)
|
||||
{
|
||||
JNIEnv* env = IDCache::GetEnvForThread();
|
||||
jobject children =
|
||||
env->CallStaticObjectMethod(IDCache::GetContentHandlerClass(),
|
||||
IDCache::GetContentHandlerGetChildNames(), ToJString(env, uri));
|
||||
return JStringArrayToVector(env, reinterpret_cast<jobjectArray>(children));
|
||||
}
|
||||
|
||||
int GetNetworkIpAddress()
|
||||
{
|
||||
JNIEnv* env = IDCache::GetEnvForThread();
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
@ -34,6 +35,9 @@ jlong GetAndroidContentSizeAndIsDirectory(const std::string& uri);
|
||||
// An empty string will be returned for files which do not exist.
|
||||
std::string GetAndroidContentDisplayName(const std::string& uri);
|
||||
|
||||
// Returns the display names of all children of a directory.
|
||||
std::vector<std::string> GetAndroidContentChildNames(const std::string& uri);
|
||||
|
||||
int GetNetworkIpAddress();
|
||||
int GetNetworkPrefixLength();
|
||||
int GetNetworkGateway();
|
||||
|
@ -46,6 +46,7 @@ static jmethodID s_content_handler_open_fd;
|
||||
static jmethodID s_content_handler_delete;
|
||||
static jmethodID s_content_handler_get_size_and_is_directory;
|
||||
static jmethodID s_content_handler_get_display_name;
|
||||
static jmethodID s_content_handler_get_child_names;
|
||||
|
||||
static jclass s_network_helper_class;
|
||||
static jmethodID s_network_helper_get_network_ip_address;
|
||||
@ -222,6 +223,11 @@ jmethodID GetContentHandlerGetDisplayName()
|
||||
return s_content_handler_get_display_name;
|
||||
}
|
||||
|
||||
jmethodID GetContentHandlerGetChildNames()
|
||||
{
|
||||
return s_content_handler_get_child_names;
|
||||
}
|
||||
|
||||
jclass GetNetworkHelperClass()
|
||||
{
|
||||
return s_network_helper_class;
|
||||
@ -323,6 +329,8 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
s_content_handler_class, "getSizeAndIsDirectory", "(Ljava/lang/String;)J");
|
||||
s_content_handler_get_display_name = env->GetStaticMethodID(
|
||||
s_content_handler_class, "getDisplayName", "(Ljava/lang/String;)Ljava/lang/String;");
|
||||
s_content_handler_get_child_names = env->GetStaticMethodID(
|
||||
s_content_handler_class, "getChildNames", "(Ljava/lang/String;)[Ljava/lang/String;");
|
||||
|
||||
const jclass network_helper_class =
|
||||
env->FindClass("org/dolphinemu/dolphinemu/utils/NetworkHelper");
|
||||
|
@ -46,6 +46,7 @@ jmethodID GetContentHandlerOpenFd();
|
||||
jmethodID GetContentHandlerDelete();
|
||||
jmethodID GetContentHandlerGetSizeAndIsDirectory();
|
||||
jmethodID GetContentHandlerGetDisplayName();
|
||||
jmethodID GetContentHandlerGetChildNames();
|
||||
|
||||
jclass GetNetworkHelperClass();
|
||||
jmethodID GetNetworkHelperGetNetworkIpAddress();
|
||||
|
Reference in New Issue
Block a user