mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-04 05:59:07 +08:00
283f99c84a
It appears like the aws-sdk-cpp maintainers, in an attempt to avoid a warning when compiling with Visual Studio, opted to use a Microsoft-only function for reading environment variables. As a result, linking the library will fail in MinGW environments. This PR adds a patch to aws-sdk-cpp port that will replace the non-standard function with a standard compliant version when being compiled for Windows using a non-Microsoft compiler. - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [ ] SHA512s are updated for each updated download. - [ ] The "supports" clause reflects platforms that may be fixed by this new version. - [ ] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [ ] Any patches that are no longer applied are deleted from the port's directory. - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file.
24 lines
874 B
Diff
24 lines
874 B
Diff
diff --git a/src/aws-cpp-sdk-core/source/platform/windows/Environment.cpp b/src/aws-cpp-sdk-core/source/platform/windows/Environment.cpp
|
|
index d8b540312..b552a9dbf 100644
|
|
--- a/src/aws-cpp-sdk-core/source/platform/windows/Environment.cpp
|
|
+++ b/src/aws-cpp-sdk-core/source/platform/windows/Environment.cpp
|
|
@@ -19,6 +19,7 @@ that would need to be manually freed in all the client functions, just copy it i
|
|
*/
|
|
Aws::String GetEnv(const char *variableName)
|
|
{
|
|
+#ifdef _MSC_VER
|
|
char* variableValue = nullptr;
|
|
std::size_t valueSize = 0;
|
|
auto queryResult = _dupenv_s(&variableValue, &valueSize, variableName);
|
|
@@ -31,6 +32,10 @@ Aws::String GetEnv(const char *variableName)
|
|
}
|
|
|
|
return result;
|
|
+#else
|
|
+ auto variableValue = std::getenv(variableName);
|
|
+ return Aws::String( variableValue ? variableValue : "" );
|
|
+#endif
|
|
}
|
|
|
|
} // namespace Environment
|