From 2cc849df37948c7beae0dada575c512ac8d1b06a Mon Sep 17 00:00:00 2001 From: Joseph Werle Date: Thu, 28 Sep 2023 08:45:49 -0400 Subject: [PATCH] fix(android): fix build and 'Runtime::isPermissionAllowed' --- bin/generate-compile-flags-txt.sh | 2 +- src/android/internal.hh | 1 + src/android/runtime.cc | 2 +- src/common.hh | 8 ++++---- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/generate-compile-flags-txt.sh b/bin/generate-compile-flags-txt.sh index 7d0e188a84..194e45a4d6 100755 --- a/bin/generate-compile-flags-txt.sh +++ b/bin/generate-compile-flags-txt.sh @@ -58,7 +58,7 @@ while (( $# > 0 )); do done function generate () { - local cflags=($("$root/bin/cflags.sh" "${args[@]}") -ferror-limit=0 -I"$root/src") + local cflags=($("$root/bin/cflags.sh" "${args[@]}") -ferror-limit=0 -I"$root/src" -U__APPLE__) for flag in "${cflags[@]}"; do echo "$flag" diff --git a/src/android/internal.hh b/src/android/internal.hh index 9653686f59..4986cea50b 100644 --- a/src/android/internal.hh +++ b/src/android/internal.hh @@ -218,6 +218,7 @@ namespace SSC::android { Runtime (JNIEnv* env, jobject self, String rootDirectory); ~Runtime (); + bool isPermissionAllowed (const String&) const; }; class Bridge : public IPC::Bridge { diff --git a/src/android/runtime.cc b/src/android/runtime.cc index b038f82f90..a3b1bddf81 100644 --- a/src/android/runtime.cc +++ b/src/android/runtime.cc @@ -12,7 +12,7 @@ namespace SSC::android { this->rootDirectory = rootDirectory; } - bool isPermissionAllowed (const String& name) { + bool Runtime::isPermissionAllowed (const String& name) const { static const auto config = SSC::getUserConfig(); const auto permission = String("permissions_allow_") + name; diff --git a/src/common.hh b/src/common.hh index d16f149350..a576efffbb 100644 --- a/src/common.hh +++ b/src/common.hh @@ -195,15 +195,15 @@ static os_log_t SSC_OS_LOG_DEBUG_BUNDLE = nullptr; #define ToString(string) String(string) namespace SSC { +#if !(defined(__APPLE__) && TARGET_OS_IPHONE && TARGET_OS_SIMULATOR) namespace fs = std::filesystem; + using Path = fs::path; +#endif using String = std::string; using StringStream = std::stringstream; using WString = std::wstring; using WStringStream = std::wstringstream; -#if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR - using Path = fs::path; -#endif template using Queue = std::queue; template using Vector = std::vector; @@ -682,7 +682,7 @@ namespace SSC { notifyCli(); } - #if !TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR + #if !(defined(__APPLE__) && TARGET_OS_IPHONE && TARGET_OS_SIMULATOR) inline String readFile (fs::path path) { if (fs::is_directory(path)) { stdWrite("WARNING: trying to read a directory as a file: " + path.string(), true);