| 244 | } |
| 245 | |
| 246 | static bool createTextFile(const fl::string& path, const fl::string& content) FL_NOEXCEPT { |
| 247 | // Force remove any existing file first to ensure clean state |
| 248 | removeFile(path.c_str()); |
| 249 | |
| 250 | // Create new file with explicit truncate mode |
| 251 | fl::ofstream ofs(path.c_str(), fl::ios::binary | fl::ios::trunc) FL_NOEXCEPT; |
| 252 | if (!ofs.is_open()) { |
| 253 | return false; |
| 254 | } |
| 255 | ofs.write(content.data(), content.size()); // Use write() instead of << for exact byte control |
| 256 | bool success = ofs.good(); // Check status before close |
| 257 | ofs.close(); // Explicitly close to flush buffers before reading |
| 258 | return success; |
| 259 | } |
| 260 | |
| 261 | bool begin() FL_NOEXCEPT override { |
| 262 | return true; |