mirror of https://gitee.com/openkylin/kwin.git
main: try to load plugin from build bin folder
first when debug This will make debug plugin more easy. Signed-off-by: Hongfei Shang <shanghongfei@kylinos.cn>
This commit is contained in:
parent
8eac0b1356
commit
205b84c4cd
|
@ -500,6 +500,27 @@ int main(int argc, char * argv[])
|
|||
// reset QT_QPA_PLATFORM so we don't propagate it to our children (e.g. apps launched from the overview effect)
|
||||
qunsetenv("QT_QPA_PLATFORM");
|
||||
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
QStringList newLibPaths(a.applicationDirPath());
|
||||
const QStringList oldLibPaths = QCoreApplication::libraryPaths();
|
||||
if (newLibPaths.contains("/usr/local/bin")) {
|
||||
// when do “make install”, we need add plugins directory before normal qt plugins directory.
|
||||
// we can get arch lib directory name from qt plugins directory and do a replace
|
||||
// from "/usr/lib/x86_64-linux-gnu/qt5/plugins" to "/usr/local/lib/x86_64-linux-gnu/plugins"
|
||||
// then kwin will load the right plugins.
|
||||
QRegularExpression re("^/usr/lib/(.*)/qt.*$");
|
||||
QStringList plugins = oldLibPaths.filter(QRegularExpression("^/usr/lib/"))
|
||||
.replaceInStrings(re, "/usr/local/lib/\\1/plugins");
|
||||
newLibPaths.append(plugins);
|
||||
}
|
||||
newLibPaths.append(oldLibPaths);
|
||||
QCoreApplication::setLibraryPaths(newLibPaths);
|
||||
qDebug() << "debug mode:";
|
||||
qDebug() << " set application dir path to be the first of libraryPaths,";
|
||||
qDebug() << " so we can be happy to debug kwin plugins.";
|
||||
qDebug() << " libraryPaths:" << newLibPaths;
|
||||
#endif
|
||||
|
||||
KWin::Application::createAboutData();
|
||||
KQuickAddons::QtQuickSettings::init();
|
||||
|
||||
|
|
|
@ -537,6 +537,27 @@ int main(int argc, char * argv[])
|
|||
KWin::ApplicationX11 a(argc, argv);
|
||||
a.setupTranslator();
|
||||
|
||||
#if !defined(QT_NO_DEBUG)
|
||||
QStringList newLibPaths(a.applicationDirPath());
|
||||
const QStringList oldLibPaths = QCoreApplication::libraryPaths();
|
||||
if (newLibPaths.contains("/usr/local/bin")) {
|
||||
// when do “make install”, we need add plugins directory before normal qt plugins directory.
|
||||
// we can get arch lib directory name from qt plugins directory and do a replace
|
||||
// from "/usr/lib/x86_64-linux-gnu/qt5/plugins" to "/usr/local/lib/x86_64-linux-gnu/plugins"
|
||||
// then kwin will load the right plugins.
|
||||
QRegularExpression re("^/usr/lib/(.*)/qt.*$");
|
||||
QStringList plugins = oldLibPaths.filter(QRegularExpression("^/usr/lib/"))
|
||||
.replaceInStrings(re, "/usr/local/lib/\\1/plugins");
|
||||
newLibPaths.append(plugins);
|
||||
}
|
||||
newLibPaths.append(oldLibPaths);
|
||||
QCoreApplication::setLibraryPaths(newLibPaths);
|
||||
qDebug() << "debug mode:";
|
||||
qDebug() << " set application dir path to be the first of libraryPaths,";
|
||||
qDebug() << " so we can be happy to debug kwin plugins.";
|
||||
qDebug() << " libraryPaths:" << newLibPaths;
|
||||
#endif
|
||||
|
||||
KWin::Application::createAboutData();
|
||||
KQuickAddons::QtQuickSettings::init();
|
||||
|
||||
|
|
Loading…
Reference in New Issue