blob: 9b5328ee56393c2af3c4d8fab242a36c4d3df9bd [file] [log] [blame]
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "modemfwd/scoped_temp_file.h"
#include <utility>
#include <base/files/file_util.h>
namespace modemfwd {
// static
std::unique_ptr<ScopedTempFile> ScopedTempFile::Create() {
base::FilePath path;
if (!base::CreateTemporaryFile(&path))
return nullptr;
return std::unique_ptr<ScopedTempFile>(new ScopedTempFile(path));
}
ScopedTempFile::ScopedTempFile(const base::FilePath& path) : path_(path) {}
ScopedTempFile::~ScopedTempFile() {
base::DeleteFile(path_);
}
} // namespace modemfwd