Skip to content

Commit 6bc32b3

Browse files
committed
fix: avoid bad python path in some situations in linux
1 parent e4ba8c4 commit 6bc32b3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/hobbits-core/settingsdata.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
SettingsData::SettingsData()
99
{
1010
QString pythonHome;
11+
QString appDirPath = QCoreApplication::applicationDirPath();
12+
if (!appDirPath.isEmpty()) {
13+
appDirPath += "/";
14+
}
1115
#ifdef Q_OS_LINUX
12-
pythonHome = QCoreApplication::applicationDirPath()+"/../python";
16+
pythonHome = appDirPath+"../python";
1317
#endif
1418
#ifdef Q_OS_MACOS
15-
pythonHome = QCoreApplication::applicationDirPath()+"/../Frameworks/python";
19+
pythonHome = appDirPath+"../Frameworks/python";
1620
#endif
1721
#ifdef Q_OS_WIN
18-
pythonHome = QCoreApplication::applicationDirPath();
22+
pythonHome = appDirPath;
1923
#endif
2024
QString pythonHomeCanonical = QDir(pythonHome).canonicalPath();
2125
// The canonical path will be empty if it doesn't exist, so we'll fall back on the base path for easier debugging

0 commit comments

Comments
 (0)