diff --git a/src/lib/app/paths/ResourcePaths.cpp b/src/lib/app/paths/ResourcePaths.cpp index 593a8f75..56fa0393 100644 --- a/src/lib/app/paths/ResourcePaths.cpp +++ b/src/lib/app/paths/ResourcePaths.cpp @@ -37,12 +37,22 @@ FilePath ResourcePaths::getJavaPath() return AppPath::getSharedDataPath().concatenate(L"data/java/"); } -FilePath ResourcePaths::getPythonPath() +FilePath ResourcePaths::getPythonEnvironmentFilePath() { - return AppPath::getSharedDataPath().concatenate(L"data/python/"); + return ResourcePaths::getPythonPath().concatenate(L"environment/Scripts/python"); +} + +FilePath ResourcePaths::getPythonIndexerFilePath() +{ + return ResourcePaths::getPythonPath().concatenate(L"indexer/run.py"); } FilePath ResourcePaths::getCxxCompilerHeaderPath() { return AppPath::getSharedDataPath().concatenate(L"data/cxx/include/").getCanonical(); } + +FilePath ResourcePaths::getPythonPath() +{ + return AppPath::getSharedDataPath().concatenate(L"data/python/"); +} diff --git a/src/lib/app/paths/ResourcePaths.h b/src/lib/app/paths/ResourcePaths.h index a7fa351d..49c33c20 100644 --- a/src/lib/app/paths/ResourcePaths.h +++ b/src/lib/app/paths/ResourcePaths.h @@ -15,8 +15,12 @@ public: static FilePath getGuiPath(); static FilePath getLicensePath(); static FilePath getJavaPath(); - static FilePath getPythonPath(); + static FilePath getPythonEnvironmentFilePath(); + static FilePath getPythonIndexerFilePath(); static FilePath getCxxCompilerHeaderPath(); + +private: + static FilePath getPythonPath(); }; #endif // RESOURCE_PATHS_H diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp index 9c3b1326..486009e6 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp @@ -24,13 +24,13 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) { std::string pythonIndexerVersion = " "; { - std::string str = - utility::executeProcess( - ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"), - {L"--version"}, - FilePath(), - 5000) - .second; + std::string str = utility::executeProcess( + ResourcePaths::getPythonEnvironmentFilePath().wstr(), + std::vector { + ResourcePaths::getPythonIndexerFilePath().wstr(), L"--version"}, + FilePath(), + 5000) + .second; std::regex regex( "v\\d*\\.db\\d*\\.p\\d*"); // "\\d" matches any digit; "\\." matches the "." character std::smatch matches; diff --git a/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathPythonEnvironment.cpp b/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathPythonEnvironment.cpp index d8f1a5fa..4eb40947 100644 --- a/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathPythonEnvironment.cpp +++ b/src/lib_gui/qt/project_wizard/content/path/QtProjectWizardContentPathPythonEnvironment.cpp @@ -63,12 +63,14 @@ void QtProjectWizardContentPathPythonEnvironment::onTextChanged(const QString& t m_resultLabel->setText("Checking validity of Python environment..."); std::thread([=]() { std::pair out = utility::executeProcess( - ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"), - {L"check-environment", - L"--environment-path " + - utility::getExpandedAndAbsolutePath( - FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath()) - .wstr()}, + ResourcePaths::getPythonEnvironmentFilePath().wstr(), + std::vector { + ResourcePaths::getPythonIndexerFilePath().wstr(), + L"check-environment", + L"--environment-path " + + utility::getExpandedAndAbsolutePath( + FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath()) + .wstr()}, FilePath(), 5000); m_onQtThread([=]() { diff --git a/src/lib_python/project/SourceGroupPythonEmpty.cpp b/src/lib_python/project/SourceGroupPythonEmpty.cpp index 16aa82ae..17ad8ba1 100644 --- a/src/lib_python/project/SourceGroupPythonEmpty.cpp +++ b/src/lib_python/project/SourceGroupPythonEmpty.cpp @@ -79,7 +79,8 @@ std::vector> SourceGroupPythonEmpty::getIndexerC { indexerCommands.push_back(std::make_shared( INDEXER_COMMAND_PYTHON, - L"\"" + ResourcePaths::getPythonPath().wstr() + L"SourcetrailPythonIndexer\"", + L"\"" + ResourcePaths::getPythonEnvironmentFilePath().wstr() + L"\" \"" + + ResourcePaths::getPythonIndexerFilePath().wstr() + L"\"", args, m_settings->getProjectSettings()->getProjectFilePath(), m_settings->getProjectSettings()->getTempDBFilePath(),