summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGennadiy Civil <misterg@google.com>2017-05-18 14:19:28 (GMT)
committerGennadiy Civil <misterg@google.com>2017-05-18 14:19:28 (GMT)
commit76491b74de24c743f6e1780eaee91c589e757b11 (patch)
tree42710fec8b759352c5df2ab666b06b7efc7904d8
parent7cc548dcbf266d48c9b3fe8ec30c2f2ba8acb1d9 (diff)
downloadgoogletest-76491b74de24c743f6e1780eaee91c589e757b11.zip
googletest-76491b74de24c743f6e1780eaee91c589e757b11.tar.gz
googletest-76491b74de24c743f6e1780eaee91c589e757b11.tar.bz2
Changes add ability to overwrite TempDir(), issue https://github.com/google/googletest/issues/1093refs/pull/1096/head
-rw-r--r--googletest/include/gtest/internal/custom/gtest.h4
-rw-r--r--googletest/src/gtest.cc4
2 files changed, 7 insertions, 1 deletions
diff --git a/googletest/include/gtest/internal/custom/gtest.h b/googletest/include/gtest/internal/custom/gtest.h
index c27412a..a7a1c0b 100644
--- a/googletest/include/gtest/internal/custom/gtest.h
+++ b/googletest/include/gtest/internal/custom/gtest.h
@@ -33,6 +33,10 @@
// GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of
// OsStackTraceGetterInterface.
//
+// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
+// See testing::TempDir for semantics and
+// signature.
+//
// ** Custom implementation starts here **
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index de03212..3a18f25 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -5385,6 +5385,9 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
}
std::string TempDir() {
+#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_)
+ return GTEST_CUSTOM_TEMPDIR_FUNCTION_();
+#endif
#if GTEST_OS_WINDOWS_MOBILE
return "\\temp\\";
#elif GTEST_OS_WINDOWS
@@ -5402,5 +5405,4 @@ std::string TempDir() {
#endif // GTEST_OS_WINDOWS_MOBILE
}
-
} // namespace testing