diff --git a/runtime/Server.cpp b/runtime/Server.cpp index fd930f6..921752e 100644 --- a/runtime/Server.cpp +++ b/runtime/Server.cpp @@ -103,6 +103,17 @@ bool Server::Init() { QSettings settings; +#ifdef Q_OS_LINUX + // In case we are running in a release RPM, the web app will be present in + // the default python lib on the system. Hence, find that path run time. + QProcess process; + process.start("python -c \"from distutils.sysconfig import get_python_lib; print(get_python_lib())\""); + process.waitForFinished(-1); + QString pymodules_path = process.readAllStandardOutput(); + pymodules_path = pymodules_path.trimmed(); + webapp_path = pymodules_path + "/pgadmin4-web-v1"; +#endif + // Find the webapp QStringList paths; paths.append("../web/"); // Linux source tree @@ -111,13 +122,22 @@ bool Server::Init() #ifdef Q_OS_MAC paths.append("../Resources/web/"); // Mac source tree (in a release app bundle) #endif +#ifdef Q_OS_LINUX + paths.append(webapp_path); // Linux (in a release RPM) +#endif paths.append(settings.value("ApplicationPath").toString()); // System configured value paths.append(""); // Should be last! for (int i = 0; i < paths.size(); ++i) { QDir dir(QCoreApplication::applicationDirPath() + "/" + paths[i]); - m_appfile = dir.canonicalPath() + "/pgAdmin4.py"; + QFileInfo info(paths[i]); + if (info.isRelative()) { + m_appfile = dir.absolutePath() + "/pgAdmin4.py"; + } + else { + m_appfile = paths[i] + "/pgAdmin4.py"; + } if (QFile::exists(m_appfile)) {