MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / addToPythonPathFunctor

Function addToPythonPathFunctor

Engine/AppManager.cpp:1774–1796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1772}
1773
1774static void
1775addToPythonPathFunctor(const QDir& directory)
1776{
1777 std::string addToPythonPath("sys.path.append(str('");
1778
1779 addToPythonPath += directory.absolutePath().toStdString();
1780#if PY_MAJOR_VERSION >= 3
1781 addToPythonPath += "'))\n";
1782#else
1783 addToPythonPath += "').decode('utf-8'))\n";
1784#endif
1785
1786 std::string err;
1787 bool ok = NATRON_PYTHON_NAMESPACE::interpretPythonScript(addToPythonPath, &err, 0);
1788 if (!ok) {
1789 std::string message = QCoreApplication::translate("AppManager", "Could not add %1 to python path:").arg( directory.absolutePath() ).toStdString() + ' ' + err;
1790 std::cerr << message << std::endl;
1791 AppInstancePtr topLevel = appPTR->getTopLevelInstance();
1792 if (topLevel) {
1793 topLevel->appendToScriptEditor( message.c_str() );
1794 }
1795 }
1796}
1797
1798void
1799AppManager::findAllScriptsRecursive(const QDir& directory,

Callers

nothing calls this directly

Calls 5

toStdStringMethod · 0.80
absolutePathMethod · 0.80
getTopLevelInstanceMethod · 0.80
translateFunction · 0.50
appendToScriptEditorMethod · 0.45

Tested by

no test coverage detected