diff options
author | Stephen Hines <srhines@google.com> | 2012-09-12 17:02:35 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-09-12 17:02:35 -0700 |
commit | e7520b618642d25d01bac09d7dc442381af6cf71 (patch) | |
tree | 1d6309a789fe84e462a2021e56a2bbc60eaf053a | |
parent | 4bde28eecdacd071cb5cf09a86e740f90361de1b (diff) | |
parent | 344e5f3db17615cc853073a02968a603efd39109 (diff) | |
download | gtest-e7520b618642d25d01bac09d7dc442381af6cf71.tar.gz |
am 344e5f3d: Use instead of /sdcard.
* commit '344e5f3db17615cc853073a02968a603efd39109':
Use $EXTERNAL_STORAGE instead of /sdcard.
-rw-r--r-- | src/gtest-port.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gtest-port.cc b/src/gtest-port.cc index f4a8def..01c5e1e 100644 --- a/src/gtest-port.cc +++ b/src/gtest-port.cc @@ -507,9 +507,20 @@ class CapturedStream { filename_ = temp_file_path; // ANDROID #elif GTEST_OS_LINUX_ANDROID - char name_template[] = "/sdcard/captured_stderr.XXXXXX"; + // Get $EXTERNAL_STORAGE from the environment, since this can change + // for shell users (fallback is still /sdcard, but this probably will + // never work properly again). + ::std::string external_storage = "/sdcard"; + char *sdcard_path = getenv("EXTERNAL_STORAGE"); + if (sdcard_path) { + external_storage = sdcard_path; + } + external_storage += "/captured_stderr.XXXXXX"; + char *name_template = strdup(external_storage.c_str()); const int captured_fd = mkstemp(name_template); filename_ = name_template; + free(name_template); + name_template = NULL; // END ANDROID # else // There's no guarantee that a test has write access to the |