7 #include <packager/file/file_test_util.h>
13 std::string generate_unique_temp_path() {
17 auto temp_path_template =
18 std::filesystem::temp_directory_path() /
"packager-test.XXXXXX";
19 std::string temp_path_template_string = temp_path_template.string();
23 _mktemp(temp_path_template_string.data());
29 int fd = mkstemp(temp_path_template_string.data());
32 return temp_path_template_string;
35 void delete_file(
const std::string& path) {
37 std::filesystem::remove(std::filesystem::u8path(path), ec);
41 TempFile::TempFile() : path_(generate_unique_temp_path()) {}
43 TempFile::~TempFile() {
45 std::filesystem::remove(std::filesystem::u8path(path_), ec);
All the methods that are virtual are virtual for mocking.