| 3260 | } |
| 3261 | |
| 3262 | void TmpFile::createTmpFile(const std::string_view dir, const std::string_view prefix) { |
| 3263 | std::string modelPattern = "%%%%-%%%%-%%%%-%%%%"; |
| 3264 | boost::format fmter("%s/%s-%s"); |
| 3265 | std::string modelPath = boost::str(boost::format(fmter % dir % prefix % modelPattern)); |
| 3266 | boost::filesystem::path filePath = boost::filesystem::unique_path(modelPath); |
| 3267 | |
| 3268 | filename = filePath.string(); |
| 3269 | |
| 3270 | // Create empty tmp file |
| 3271 | std::fstream tmpFile(filename, std::fstream::out); |
| 3272 | if (!tmpFile.good()) { |
| 3273 | TraceEvent("TmpFile_CreateFileError").detail("Filename", filename); |
| 3274 | throw io_error(); |
| 3275 | } |
| 3276 | TraceEvent("TmpFile_CreateSuccess").detail("Filename", filename); |
| 3277 | } |
| 3278 | |
| 3279 | size_t TmpFile::read(uint8_t* buff, size_t len) { |
| 3280 | return readFileBytes(filename, buff, len); |
nothing calls this directly
no test coverage detected