comparison 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
comparison
equal deleted inserted replaced
508:26ebbe098bce 509:451d3c087112
190 SVApplication(int &argc, char **argv) : 190 SVApplication(int &argc, char **argv) :
191 QApplication(argc, argv), 191 QApplication(argc, argv),
192 m_readyForFiles(false), 192 m_readyForFiles(false),
193 m_filepathQueue(QStringList()), 193 m_filepathQueue(QStringList()),
194 m_mainWindow(0) 194 m_mainWindow(0)
195 { } 195 {
196 #ifdef Q_OS_MAC
197 // Override the Qt plugin load path. The default contains the
198 // Qt installation location as well as the application
199 // directory, but we don't ever want to load plugins from
200 // outside the app bundle because we don't know for sure what
201 // (potentially different) versions of the Qt framework
202 // libraries they may have dyld dependencies on.
203 QString apploc(applicationFilePath());
204 apploc.truncate(apploc.lastIndexOf(QLatin1Char('/')));
205 apploc = QDir(apploc).canonicalPath();
206 if (QFile::exists(apploc)) {
207 setLibraryPaths(QStringList() << apploc);
208 } else {
209 setLibraryPaths(QStringList());
210 }
211 #endif
212 }
196 virtual ~SVApplication() { } 213 virtual ~SVApplication() { }
197 214
198 void setMainWindow(MainWindow *mw) { m_mainWindow = mw; } 215 void setMainWindow(MainWindow *mw) { m_mainWindow = mw; }
199 void releaseMainWindow() { m_mainWindow = 0; } 216 void releaseMainWindow() { m_mainWindow = 0; }
200 217