MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / runScriptFromFile

Method runScriptFromFile

Source/Falcor/Utils/Scripting/Scripting.cpp:149–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149Scripting::RunResult Scripting::runScriptFromFile(const std::filesystem::path& path, Context& context, bool captureOutput)
150{
151 if (std::filesystem::exists(path))
152 {
153 std::string absFile = std::filesystem::absolute(path).string();
154 context.setObject("__file__", absFile);
155 auto result = Scripting::runScript(readFile(path), context, captureOutput);
156 context.setObject("__file__", nullptr); // There seems to be no API on pybind11::dict to remove a key.
157 return result;
158 }
159 FALCOR_THROW("Failed to run script. Can't find the file '{}'.", path);
160}
161
162std::string Scripting::interpretScript(const std::string& script, Context& context)
163{

Callers

nothing calls this directly

Calls 4

runScriptFunction · 0.85
readFileFunction · 0.85
setObjectMethod · 0.80
stringMethod · 0.45

Tested by

no test coverage detected