Merge "base: allow creating tempfile in a custom temporary dir."

am: 665f144566

Change-Id: Ibf63af87835763700682163cbe8feb60dc081b01
This commit is contained in:
Yabin Cui 2017-12-07 18:31:36 +00:00 committed by android-build-merger
commit d773ceb28a
2 changed files with 5 additions and 0 deletions

View file

@ -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

View file

@ -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);