mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 06:48:33 +00:00
Android: Add content provider support to File::OpenFStream
This commit is contained in:
parent
64afe97491
commit
99ffee9a0a
3 changed files with 38 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "jni/AndroidCommon/AndroidCommon.h"
|
||||
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
@ -66,6 +67,28 @@ std::string OpenModeToAndroid(std::string mode)
|
|||
return mode;
|
||||
}
|
||||
|
||||
std::string OpenModeToAndroid(std::ios_base::openmode mode)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
if (mode & std::ios_base::in)
|
||||
result += 'r';
|
||||
|
||||
if (mode & (std::ios_base::out | std::ios_base::app))
|
||||
result += 'w';
|
||||
|
||||
if (mode & std::ios_base::app)
|
||||
result += 'a';
|
||||
|
||||
constexpr std::ios_base::openmode t = std::ios_base::in | std::ios_base::trunc;
|
||||
if ((mode & t) == t)
|
||||
result += 't';
|
||||
|
||||
// The 'b' specifier is not supported. Since we're on POSIX, it's fine to just skip it.
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int OpenAndroidContent(const std::string& uri, const std::string& mode)
|
||||
{
|
||||
JNIEnv* env = IDCache::GetEnvForThread();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue