vcpkg/ports/aws-sdk-cpp/fix-mingw-compatibility.patch

24 lines
874 B
Diff
Raw Normal View History

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