Mercurial > hg > sonic-visualiser
diff main/main.cpp @ 509:451d3c087112
Override Qt library path on OS/X to avoid dependencies on unknown versions from outside the app bundle
author | Chris Cannam |
---|---|
date | Mon, 16 Jul 2012 10:29:38 +0100 |
parents | 3a85461ab9a7 |
children | bf1c6e2b8791 0b094b0fdcc4 |
line wrap: on
line diff
--- a/main/main.cpp Mon Jul 02 12:46:25 2012 +0100 +++ b/main/main.cpp Mon Jul 16 10:29:38 2012 +0100 @@ -192,7 +192,24 @@ m_readyForFiles(false), m_filepathQueue(QStringList()), m_mainWindow(0) - { } + { +#ifdef Q_OS_MAC + // Override the Qt plugin load path. The default contains the + // Qt installation location as well as the application + // directory, but we don't ever want to load plugins from + // outside the app bundle because we don't know for sure what + // (potentially different) versions of the Qt framework + // libraries they may have dyld dependencies on. + QString apploc(applicationFilePath()); + apploc.truncate(apploc.lastIndexOf(QLatin1Char('/'))); + apploc = QDir(apploc).canonicalPath(); + if (QFile::exists(apploc)) { + setLibraryPaths(QStringList() << apploc); + } else { + setLibraryPaths(QStringList()); + } +#endif + } virtual ~SVApplication() { } void setMainWindow(MainWindow *mw) { m_mainWindow = mw; }