| 702 | } |
| 703 | |
| 704 | std::string restoreStringFromFile(const char* FOLLY_NONNULL filePath) { |
| 705 | std::ifstream inputFile(filePath, std::ifstream::binary); |
| 706 | BOLT_CHECK(!inputFile.fail(), "Cannot open file: {}", filePath); |
| 707 | |
| 708 | // Find out file size. |
| 709 | auto begin = inputFile.tellg(); |
| 710 | inputFile.seekg(0, std::ios::end); |
| 711 | auto end = inputFile.tellg(); |
| 712 | |
| 713 | auto fileSize = end - begin; |
| 714 | if (fileSize == 0) { |
| 715 | return ""; |
| 716 | } |
| 717 | |
| 718 | // Read the file. |
| 719 | std::string result; |
| 720 | result.resize(fileSize); |
| 721 | |
| 722 | inputFile.seekg(begin); |
| 723 | inputFile.read(result.data(), fileSize); |
| 724 | inputFile.close(); |
| 725 | return result; |
| 726 | } |
| 727 | |
| 728 | std::optional<std::string> generateFolderPath( |
| 729 | const char* basePath, |