mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Use qt.conf to override plugin path on Mac OS
Summary: QCoreApplication::addLibraryPath is called before QCoreApplication was constructed and this caused the returned string to be different depending from which working directory it was called and not always the intended binary path. Using qt.conf has a fixed prefix relative to the binary path inside the application bundle and therefore is easier to be used with a relative path. Reviewers: kbasan, msutcliffe Reviewed By: msutcliffe Differential Revision: https://dev.swift-project.org/D18
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f952775665
commit
cf2c0d0f35
@@ -33,9 +33,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// I use CGuiApplication and not core application
|
||||
// otherwise no QPixmap metadata (metadata sample)
|
||||
#ifdef Q_OS_MAC
|
||||
QCoreApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
QCoreApplication qa(argc, argv);
|
||||
CApplication a(CApplicationInfo::Sample);
|
||||
Q_UNUSED(qa);
|
||||
|
||||
@@ -38,9 +38,6 @@ int main(int argc, char *argv[])
|
||||
// is just for testing, I did not split it up
|
||||
|
||||
BlackMisc::registerMetadata();
|
||||
#ifdef Q_OS_MAC
|
||||
QCoreApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
QCoreApplication a(argc, argv);
|
||||
QTextStream out(stdout, QIODevice::WriteOnly);
|
||||
QTextStream qtin(stdin);
|
||||
|
||||
@@ -29,9 +29,6 @@ using namespace BlackCore;
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QCoreApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
QCoreApplication qa(argc, argv);
|
||||
CApplication a;
|
||||
Q_UNUSED(a);
|
||||
|
||||
@@ -30,9 +30,6 @@ using namespace BlackMisc;
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QCoreApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
QCoreApplication qa(argc, argv);
|
||||
BlackCore::CApplication a;
|
||||
Q_UNUSED(a);
|
||||
|
||||
@@ -24,9 +24,6 @@ using namespace BlackMisc;
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QCoreApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
QCoreApplication app (argc, argv);
|
||||
BlackMisc::CLogHandler::instance()->install();
|
||||
|
||||
|
||||
@@ -22,9 +22,6 @@ using namespace BlackGui;
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv);
|
||||
CGuiApplication a("samplehotkey", BlackMisc::CApplicationInfo::Sample, QPixmap());
|
||||
|
||||
2
samples/hotkey/qt.conf
Normal file
2
samples/hotkey/qt.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[Paths]
|
||||
Plugins = ../..
|
||||
@@ -20,4 +20,11 @@ DESTDIR = $$DestRoot/bin
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target
|
||||
|
||||
macx {
|
||||
# Modifies plugin path
|
||||
qtconf.path = $$PREFIX/bin/samplehotkey.app/Contents/Resources
|
||||
qtconf.files = qt.conf
|
||||
INSTALLS += qtconf
|
||||
}
|
||||
|
||||
load(common_post)
|
||||
|
||||
@@ -27,9 +27,6 @@ using namespace BlackMisc::PhysicalQuantities;
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QCoreApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
QCoreApplication a(argc, argv);
|
||||
BlackMisc::registerMetadata();
|
||||
CLogHandler::instance()->install(true);
|
||||
|
||||
@@ -26,9 +26,6 @@ using namespace BlackGui;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//! [SwiftApplicationDemo]
|
||||
#ifdef Q_OS_MAC
|
||||
QApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv);
|
||||
Q_UNUSED(qa); // init of qa is required, but qa not used
|
||||
|
||||
2
src/swiftcore/qt.conf
Normal file
2
src/swiftcore/qt.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[Paths]
|
||||
Plugins = ../..
|
||||
@@ -29,4 +29,11 @@ DESTDIR = $$DestRoot/bin
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target
|
||||
|
||||
macx {
|
||||
# Modifies plugin path
|
||||
qtconf.path = $$PREFIX/bin/swiftcore.app/Contents/Resources
|
||||
qtconf.files = qt.conf
|
||||
INSTALLS += qtconf
|
||||
}
|
||||
|
||||
load(common_post)
|
||||
|
||||
@@ -24,9 +24,6 @@ using namespace BlackGui;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv);
|
||||
Q_UNUSED(qa);
|
||||
|
||||
2
src/swiftdata/qt.conf
Normal file
2
src/swiftdata/qt.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[Paths]
|
||||
Plugins = ../..
|
||||
@@ -30,4 +30,11 @@ DESTDIR = $$DestRoot/bin
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target
|
||||
|
||||
macx {
|
||||
# Modifies plugin path
|
||||
qtconf.path = $$PREFIX/bin/swiftdata.app/Contents/Resources
|
||||
qtconf.files = qt.conf
|
||||
INSTALLS += qtconf
|
||||
}
|
||||
|
||||
load(common_post)
|
||||
|
||||
@@ -23,9 +23,6 @@ using namespace BlackCore;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//! [SwiftApplicationDemo]
|
||||
#ifdef Q_OS_MAC
|
||||
QApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv);
|
||||
Q_UNUSED(qa); // application init needed
|
||||
|
||||
2
src/swiftguistandard/qt.conf
Normal file
2
src/swiftguistandard/qt.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[Paths]
|
||||
Plugins = ../..
|
||||
@@ -30,4 +30,11 @@ DESTDIR = $$DestRoot/bin
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target
|
||||
|
||||
macx {
|
||||
# Modifies plugin path
|
||||
qtconf.path = $$PREFIX/bin/swiftguistd.app/Contents/Resources
|
||||
qtconf.files = qt.conf
|
||||
INSTALLS += qtconf
|
||||
}
|
||||
|
||||
load(common_post)
|
||||
|
||||
@@ -30,9 +30,6 @@ using namespace BlackCore::Db;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
//! [SwiftApplicationDemo]
|
||||
#ifdef Q_OS_MAC
|
||||
QApplication::addLibraryPath(CDirectoryUtils::applicationDirectoryPath());
|
||||
#endif
|
||||
CGuiApplication::highDpiScreenSupport();
|
||||
QApplication qa(argc, argv); // needed
|
||||
Q_UNUSED(qa);
|
||||
|
||||
2
src/swiftlauncher/qt.conf
Normal file
2
src/swiftlauncher/qt.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[Paths]
|
||||
Plugins = ../..
|
||||
@@ -31,4 +31,11 @@ DESTDIR = $$DestRoot/bin
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target
|
||||
|
||||
macx {
|
||||
# Modifies plugin path
|
||||
qtconf.path = $$PREFIX/bin/swiftlauncher.app/Contents/Resources
|
||||
qtconf.files = qt.conf
|
||||
INSTALLS += qtconf
|
||||
}
|
||||
|
||||
load(common_post)
|
||||
|
||||
Reference in New Issue
Block a user