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

Method resolveModule

source/cpu.cpp:284–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 }
283
284 std::optional<Luau::ModuleInfo> resolveModule(const Luau::ModuleInfo* context, Luau::AstExpr* node) override {
285 if (Luau::AstExprConstantString* expr = node->as<Luau::AstExprConstantString>()) {
286 StringBuilder builder(g_pArenaFrame);
287 builder.AppendChars(expr->value.data, expr->value.size);
288
289 // we expect include calls to give the exact filename
290 // so we won't construct any extensions or what have you
291 String includeName = builder.CreateString(g_pArenaFrame, false);
292 String realPath;
293 VFSPathToRealPath(includeName, realPath, g_pArenaFrame);
294
295 if (!FileExists(realPath)) {
296 // check if the include is in system/shared/ (assuming it's a relative path)
297 if (includeName[0] != '/') {
298 realPath = TempPrint("system/shared/%S", includeName);
299 }
300 }
301
302 Luau::ModuleName name = std::string(realPath.pData, realPath.length);
303 return {{name}};
304 }
305
306 return std::nullopt;
307 }
308
309 std::string getHumanReadableModuleName(const Luau::ModuleName& name) const override {
310 String vfsBasePath = TempPrint("system/%s/", Cpu::GetAppName().pData);

Callers

nothing calls this directly

Calls 1

VFSPathToRealPathFunction · 0.85

Tested by

no test coverage detected