diff options
author | Gennadiy Civil <misterg@google.com> | 2017-05-02 18:16:11 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2017-05-02 18:16:11 (GMT) |
commit | 611e8a99de2b1c049fcd65c0d32a532c1b6301d6 (patch) | |
tree | a2d81b0832231e7017dcadeeae58301ab8920124 /googletest/src/gtest.cc | |
parent | aa148eb2b7f70ede0eb10de34b6254826bfb34f4 (diff) | |
download | googletest-611e8a99de2b1c049fcd65c0d32a532c1b6301d6.zip googletest-611e8a99de2b1c049fcd65c0d32a532c1b6301d6.tar.gz googletest-611e8a99de2b1c049fcd65c0d32a532c1b6301d6.tar.bz2 |
Changes to make TempDir() publicrefs/pull/1077/head
Fixes #1076.
Diffstat (limited to 'googletest/src/gtest.cc')
-rw-r--r-- | googletest/src/gtest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index d882ab2..d6fd8a6 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -5385,4 +5385,23 @@ void InitGoogleTest(int* argc, wchar_t** argv) { #endif // defined(GTEST_CUSTOM_INIT_GOOGLE_TEST_FUNCTION_) } +std::string TempDir() { +#if GTEST_OS_WINDOWS_MOBILE + return "\\temp\\"; +#elif GTEST_OS_WINDOWS + const char* temp_dir = internal::posix::GetEnv("TEMP"); + if (temp_dir == NULL || temp_dir[0] == '\0') + return "\\temp\\"; + else if (temp_dir[strlen(temp_dir) - 1] == '\\') + return temp_dir; + else + return std::string(temp_dir) + "\\"; +#elif GTEST_OS_LINUX_ANDROID + return "/sdcard/"; +#else + return "/tmp/"; +#endif // GTEST_OS_WINDOWS_MOBILE +} + + } // namespace testing |