| 243 | } |
| 244 | |
| 245 | int cliLuaReadFile(lua_State* L) { |
| 246 | auto path = cliGetString(L, 1); |
| 247 | std::ifstream in(path, std::ios::binary); |
| 248 | if (!in) { |
| 249 | cliPushFileError(L, "failed to read file: " + path); |
| 250 | return 2; |
| 251 | } |
| 252 | std::string content((std::istreambuf_iterator<char>(in)), std::istreambuf_iterator<char>()); |
| 253 | lua_pushlstring(L, content.data(), content.size()); |
| 254 | return 1; |
| 255 | } |
| 256 | |
| 257 | int cliLuaWriteFile(lua_State* L) { |
| 258 | auto path = fs::path(cliGetString(L, 1)); |
nothing calls this directly
no test coverage detected