Android: Make the handling of SAF open modes more robust

This commit is contained in:
JosJuice 2020-11-04 20:59:39 +01:00
parent 6a4ac74ec4
commit 70df5446d3
4 changed files with 43 additions and 25 deletions

View file

@ -12,5 +12,14 @@ std::string GetJString(JNIEnv* env, jstring jstr);
jstring ToJString(JNIEnv* env, const std::string& str);
std::vector<std::string> JStringArrayToVector(JNIEnv* env, jobjectArray array);
// 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);
// Opens a given file and returns a file descriptor.
int OpenAndroidContent(const std::string& uri, const std::string& mode);
// Deletes a given file.
bool DeleteAndroidContent(const std::string& uri);