| 55 | // *********************************************************************** |
| 56 | |
| 57 | int VfsLoad(lua_State* L) { |
| 58 | u64 filenameLen; |
| 59 | const char* filename = luaL_checklstring(L, 1, &filenameLen); |
| 60 | |
| 61 | String realFileName; |
| 62 | if (!VFSPathToRealPath(String(filename), realFileName, g_pArenaFrame)) { |
| 63 | luaL_error(L, "Filepath not in a valid mount point", filename); |
| 64 | return 0; |
| 65 | } |
| 66 | |
| 67 | |
| 68 | i64 fileSize; |
| 69 | char* pFileContent = ReadWholeFile(realFileName, &fileSize, g_pArenaFrame); |
| 70 | if (pFileContent == nullptr) { |
| 71 | luaL_error(L, "Failed to load file %s", filename); |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | lua_pushlstring(L, pFileContent, fileSize); |
| 76 | i32 retVals = Deserialize(L); |
| 77 | |
| 78 | // this function expects the table to be hot reloaded is on the top of the stack |
| 79 | Cpu::EnableHotReloadForFile(L, realFileName); |
| 80 | return retVals; |
| 81 | } |
| 82 | |
| 83 | // *********************************************************************** |
| 84 |
nothing calls this directly
no test coverage detected