aboutsummaryrefslogtreecommitdiff
path: root/googletest/src/gtest-port.cc
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-05-07 01:07:36 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-05-07 01:07:36 +0000
commitde955b2aae418f75d086890d43a86d7f326c2187 (patch)
tree54fb90f190c69a329c719650bad4fe22bf879033 /googletest/src/gtest-port.cc
parent442763cc2868a0b933ea6b7d62d0f384a1c26e4d (diff)
parent8b0c6c7eb318bdfd4cb550c7fe9905053f088aa3 (diff)
downloadgoogletest-de955b2aae418f75d086890d43a86d7f326c2187.tar.gz
Snap for 7343210 from 8b0c6c7eb318bdfd4cb550c7fe9905053f088aa3 to sc-d1-release
Change-Id: Id20ed6c7253ff3f45c0545a43bd031d935e6d7ba
Diffstat (limited to 'googletest/src/gtest-port.cc')
-rw-r--r--googletest/src/gtest-port.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc
index c7717cfb..78f7587b 100644
--- a/googletest/src/gtest-port.cc
+++ b/googletest/src/gtest-port.cc
@@ -80,6 +80,10 @@
# include <zircon/syscalls.h>
#endif // GTEST_OS_FUCHSIA
+#if GTEST_OS_IOS
+#import <Foundation/Foundation.h>
+#endif // GTEST_OS_IOS
+
#include "gtest/gtest-spi.h"
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-internal.h"
@@ -1111,9 +1115,15 @@ class CapturedStream {
// guaranteed to be mounted, or may have a delay in mounting.
::std::string name_template_buf = TempDir() + "gtest_captured_stream.XXXXXX";
char* name_template = &name_template_buf[0];
+# elif GTEST_OS_IOS
+ NSString* temp_path = [NSTemporaryDirectory()
+ stringByAppendingPathComponent:@"gtest_captured_stream.XXXXXX"];
+
+ char name_template[PATH_MAX + 1];
+ strncpy(name_template, [temp_path UTF8String], PATH_MAX);
# else
char name_template[] = "/tmp/captured_stream.XXXXXX";
-# endif // GTEST_OS_LINUX_ANDROID
+# endif
const int captured_fd = mkstemp(name_template);
if (captured_fd == -1) {
GTEST_LOG_(WARNING)