Merge pull request #10163 from JosJuice/b

Android: Improve OpenModeToAndroid's handling of 'b'
This commit is contained in:
Léo Lam 2021-10-13 20:43:33 +02:00 committed by GitHub
commit a0a91ec4b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -3,6 +3,7 @@
#include "jni/AndroidCommon/AndroidCommon.h"
#include <algorithm>
#include <ios>
#include <string>
#include <string_view>
@ -67,8 +68,7 @@ bool IsPathAndroidContent(const std::string& uri)
std::string OpenModeToAndroid(std::string mode)
{
// The 'b' specifier is not supported by Android. Since we're on POSIX, it's fine to just skip it.
if (!mode.empty() && mode.back() == 'b')
mode.pop_back();
mode.erase(std::remove(mode.begin(), mode.end(), 'b'));
if (mode == "r+")
mode = "rw";