From b28e5149a75e8f35d0a8b464acbe5e8fbc6ed6dd Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 13 Oct 2021 17:39:09 +0200 Subject: [PATCH] Android: Improve OpenModeToAndroid's handling of 'b' Now it also works when b isn't at the very end. (+ goes after b.) --- Source/Android/jni/AndroidCommon/AndroidCommon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Android/jni/AndroidCommon/AndroidCommon.cpp b/Source/Android/jni/AndroidCommon/AndroidCommon.cpp index 3ae630f7c0..06696b7ec6 100644 --- a/Source/Android/jni/AndroidCommon/AndroidCommon.cpp +++ b/Source/Android/jni/AndroidCommon/AndroidCommon.cpp @@ -3,6 +3,7 @@ #include "jni/AndroidCommon/AndroidCommon.h" +#include #include #include #include @@ -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";