2020-07-06 17:02:01 +02:00
|
|
|
// Copyright 2018 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-11-04 20:59:39 +01:00
|
|
|
#include <ios>
|
2020-07-06 17:02:01 +02:00
|
|
|
#include <string>
|
2020-11-08 16:57:49 +01:00
|
|
|
#include <vector>
|
2020-07-06 17:02:01 +02:00
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
std::string GetJString(JNIEnv* env, jstring jstr);
|
|
|
|
jstring ToJString(JNIEnv* env, const std::string& str);
|
|
|
|
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array);
|
2020-06-26 17:52:31 +02:00
|
|
|
|
2020-11-04 20:59:39 +01:00
|
|
|
// Returns true if the given path should be opened as Android content instead of a normal file.
|
|
|
|
bool IsPathAndroidContent(const std::string& uri);
|
|
|
|
|
|
|
|
// Turns a C/C++ style mode (e.g. "rb") into one which can be used with OpenAndroidContent.
|
|
|
|
std::string OpenModeToAndroid(std::string mode);
|
2020-11-04 20:59:39 +01:00
|
|
|
std::string OpenModeToAndroid(std::ios_base::openmode mode);
|
2020-11-04 20:59:39 +01:00
|
|
|
|
|
|
|
// Opens a given file and returns a file descriptor.
|
2020-06-26 17:52:31 +02:00
|
|
|
int OpenAndroidContent(const std::string& uri, const std::string& mode);
|
2020-11-04 20:59:39 +01:00
|
|
|
|
|
|
|
// Deletes a given file.
|
2020-06-27 11:04:48 +02:00
|
|
|
bool DeleteAndroidContent(const std::string& uri);
|
2020-11-05 19:47:23 +01:00
|
|
|
// Returns -1 if not found, -2 if directory, file size otherwise.
|
|
|
|
jlong GetAndroidContentSizeAndIsDirectory(const std::string& uri);
|
|
|
|
|
2020-11-08 15:39:17 +01:00
|
|
|
// An unmangled URI (one which the C++ code has not appended anything to) can't be relied on
|
|
|
|
// to contain a file name at all. If a file name is desired, this function is the most reliable
|
|
|
|
// way to get it, but the display name is not guaranteed to always actually be like a file name.
|
|
|
|
// An empty string will be returned for files which do not exist.
|
|
|
|
std::string GetAndroidContentDisplayName(const std::string& uri);
|
|
|
|
|
2020-11-08 23:01:59 +01:00
|
|
|
// Returns the display names of all children of a directory, non-recursively.
|
2020-11-08 16:57:49 +01:00
|
|
|
std::vector<std::string> GetAndroidContentChildNames(const std::string& uri);
|
|
|
|
|
2020-10-01 12:10:34 +04:00
|
|
|
int GetNetworkIpAddress();
|
|
|
|
int GetNetworkPrefixLength();
|
|
|
|
int GetNetworkGateway();
|