From 8903c8c1faf3a66fc892e90e4e9569a0fe1ad507 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 1 Mar 2019 16:39:08 +0000 Subject: [PATCH] Search for Android SDK in common locations on macOS * Environment variables still take priority, but it can be common for them not to be set so we need to look here. --- renderdoc/android/android_tools.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/renderdoc/android/android_tools.cpp b/renderdoc/android/android_tools.cpp index 9be0aa3b9..93f75f68e 100644 --- a/renderdoc/android/android_tools.cpp +++ b/renderdoc/android/android_tools.cpp @@ -240,6 +240,22 @@ std::string getToolPath(ToolDir subdir, const std::string &toolname, bool checkE sdk = env ? env : ""; } +#if ENABLED(RDOC_APPLE) + // on macOS it's common not to have the environment variable globally available, so try the home + // Library folder first, then the global folder + if(sdk.empty() || !FileIO::exists(sdk.c_str())) + { + std::string librarySDK = FileIO::GetHomeFolderFilename() + "/Library/Android/sdk"; + sdk = FileIO::exists(librarySDK.c_str()) ? librarySDK : ""; + } + + if(sdk.empty() || !FileIO::exists(sdk.c_str())) + { + std::string librarySDK = "/Library/Android/sdk"; + sdk = FileIO::exists(librarySDK.c_str()) ? librarySDK : ""; + } +#endif + // maybe in future we can try to search in common install locations. toolpath = getToolInSDK(subdir, jdk, sdk, toolname);