fix: can't load plugin in debug build

Log: ddm is started as user dde and cannot access other users' home directories
Fix: https://github.com/linuxdeepin/treeland/issues/388
This commit is contained in:
rewine 2025-02-19 13:19:57 +08:00 committed by zccrs
parent ed527f0594
commit dbcff753c0
1 changed files with 8 additions and 1 deletions

View File

@ -310,7 +310,14 @@ Treeland::Treeland()
QDBusConnection::sessionBus().registerObject("/org/deepin/Compositor1", this);
#ifdef QT_DEBUG
d->loadPlugin(QStringLiteral(TREELAND_PLUGINS_OUTPUT_PATH));
QDir dir(QStringLiteral(TREELAND_PLUGINS_OUTPUT_PATH));
if (dir.exists() && dir.isReadable()) {
d->loadPlugin(QStringLiteral(TREELAND_PLUGINS_OUTPUT_PATH));
} else {
qInfo() << "The Treeland plugin build directory is inaccessible, failback to the "
"installation directory";
d->loadPlugin(QStringLiteral(TREELAND_PLUGINS_INSTALL_PATH));
}
#else
d->loadPlugin(QStringLiteral(TREELAND_PLUGINS_INSTALL_PATH));
#endif