MCPcopy Create free account
hub / github.com/DavidColson/Polybox / VfsStore

Function VfsStore

source/virtual_filesystem.cpp:35–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33// ***********************************************************************
34
35int VfsStore(lua_State* L) {
36 u64 filenameLen;
37 const char* filename = luaL_checklstring(L, 1, &filenameLen);
38
39 String realFileName;
40 if (!VFSPathToRealPath(String(filename), realFileName, g_pArenaFrame)) {
41 luaL_error(L, "Filepath not in a valid mount point", filename);
42 return 0;
43 }
44
45 Serialize(L);
46
47 // string is now on the stack
48 u64 contentLen;
49 const char* content = lua_tolstring(L, -1, &contentLen);
50
51 WriteWholeFile(realFileName, content, contentLen);
52 return 0;
53}
54
55// ***********************************************************************
56

Callers

nothing calls this directly

Calls 3

VFSPathToRealPathFunction · 0.85
SerializeFunction · 0.85
StringClass · 0.70

Tested by

no test coverage detected