| 4 | |
| 5 | |
| 6 | std::optional<std::string> ReadFile(std::string_view path) { |
| 7 | std::string newPath(path); |
| 8 | #ifdef _WIN32 |
| 9 | std::fstream fin(newPath, std::ios::in | std::ios::binary); |
| 10 | #else |
| 11 | std::fstream fin(newPath, std::ios::in); |
| 12 | #endif |
| 13 | |
| 14 | if (fin.is_open()) { |
| 15 | std::stringstream s; |
| 16 | s << fin.rdbuf(); |
| 17 | return std::move(s.str()); |
| 18 | } |
| 19 | |
| 20 | return std::nullopt; |
| 21 | } |