| 41 | } |
| 42 | |
| 43 | size_t WriteTextFile(const std::string& fileName, const char* text) { |
| 44 | auto path = Utf8ToPath(fileName); |
| 45 | auto parentPath = path.parent_path(); |
| 46 | if (!parentPath.empty() && !fs::exists(parentPath)) { |
| 47 | fs::create_directories(parentPath); |
| 48 | } |
| 49 | std::ofstream file(path, std::ios::out); |
| 50 | if (!file.is_open()) { |
| 51 | return 0; |
| 52 | } |
| 53 | file << text; |
| 54 | auto size = static_cast<size_t>(file.tellp()); |
| 55 | file.close(); |
| 56 | return size; |
| 57 | } |
| 58 | |
| 59 | size_t WriteTextFile(const std::string& fileName, const std::string& text) { |
| 60 | return WriteTextFile(fileName, text.c_str()); |
no test coverage detected