diff --git a/base/include/android-base/test_utils.h b/base/include/android-base/test_utils.h index 07a5edda0..4cfa06ba5 100644 --- a/base/include/android-base/test_utils.h +++ b/base/include/android-base/test_utils.h @@ -24,6 +24,7 @@ class TemporaryFile { public: TemporaryFile(); + explicit TemporaryFile(const std::string& tmp_dir); ~TemporaryFile(); // Release the ownership of fd, caller is reponsible for closing the diff --git a/base/test_utils.cpp b/base/test_utils.cpp index 1cfa9e66f..9d8dfb2fd 100644 --- a/base/test_utils.cpp +++ b/base/test_utils.cpp @@ -84,6 +84,10 @@ TemporaryFile::TemporaryFile() { init(GetSystemTempDir()); } +TemporaryFile::TemporaryFile(const std::string& tmp_dir) { + init(tmp_dir); +} + TemporaryFile::~TemporaryFile() { if (fd != -1) { close(fd);