MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / cliLuaReadFile

Function cliLuaReadFile

Source/Basic/Application.cpp:245–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245int 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
257int cliLuaWriteFile(lua_State* L) {
258 auto path = fs::path(cliGetString(L, 1));

Callers

nothing calls this directly

Calls 5

cliGetStringFunction · 0.85
cliPushFileErrorFunction · 0.85
lua_pushlstringFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected