--- qt5.15.2/qtbase/src/corelib/global/qlibraryinfo.cpp.orig	2021-10-14 19:57:14.252103300 +0300
+++ qt5.15.2/qtbase/src/corelib/global/qlibraryinfo.cpp	2021-10-14 21:36:11.813972000 +0300
@@ -486,6 +486,28 @@
 #endif // Q_OS_DARWIN
         // We make the prefix path absolute to the executable's directory.
         appDir = QCoreApplication::applicationDirPath();
+        QDir pwd(appDir);
+        const QString bindir = QString::fromLocal8Bit(
+            qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::BinariesPath - 1]);
+        const QString libdir = QString::fromLocal8Bit(
+            qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::LibrariesPath - 1]);
+        const QString plugindir = QString::fromLocal8Bit(
+            qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::PluginsPath - 1]);
+        const QString datadir = QString::fromLocal8Bit(
+            qt_configure_strs + qt_configure_str_offsets[QLibraryInfo::DataPath - 1]);
+        const QLatin1Char slash('/');
+        QStringList binSub = bindir.split(slash);
+        bool foundPrf = true;
+        for (int i = 0; i < binSub.count(); i++) {
+            if (!pwd.cdUp()) {
+                foundPrf = false;
+            }
+        }
+        if (foundPrf) {
+            if (pwd.exists(libdir) && pwd.exists(plugindir) && pwd.exists(datadir) ) {
+                appDir = pwd.absolutePath();
+            }
+        }
     } else {
         appDir = QDir::currentPath();
     }
