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.
This commit is contained in:
baldurk
2019-03-01 16:39:08 +00:00
parent c73f045241
commit 8903c8c1fa
+16
View File
@@ -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);