MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / prependPythonPath

Function prependPythonPath

tests/test_python_integration.cpp:266–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264 }
265
266 void prependPythonPath(const std::filesystem::path& path) {
267 const auto value = path.string();
268 const char* existing = std::getenv("PYTHONPATH");
269#ifdef _WIN32
270 const char separator = ';';
271#else
272 const char separator = ':';
273#endif
274 const std::string combined =
275 existing && *existing ? value + separator + std::string(existing) : value;
276
277#ifdef _WIN32
278 _putenv_s("PYTHONPATH", combined.c_str());
279#else
280 setenv("PYTHONPATH", combined.c_str(), 1);
281#endif
282 }
283
284 std::string consumePythonError() {
285 if (!PyErr_Occurred()) {

Callers 1

SetUpMethod · 0.85

Calls 2

stringMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected