From 44041b5d942ea4b1e0a89b06b98171e868235fc0 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Fri, 14 Feb 2020 19:14:27 +0100 Subject: [PATCH] Fix Mediastreamer plugin loading[ci skip] --- CMakeLists.txt | 9 ++++++++- src/app/paths/Paths.cpp | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37b92e60f..f42478061 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -411,8 +411,15 @@ else() # ------------------------------------------------------------------------------ # Create config.h file # ------------------------------------------------------------------------------ - +if(APPLE) + if(MS2_PLUGINS_LOCATION) + set(MSPLUGINS_DIR ${MS2_PLUGINS_LOCATION}) + else() + set(MSPLUGINS_DIR "Frameworks/mediastreamer2.framework/Versions/A/Libraries") + endif() +else() set(MSPLUGINS_DIR "${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins") +endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/config.h") # ------------------------------------------------------------------------------ diff --git a/src/app/paths/Paths.cpp b/src/app/paths/Paths.cpp index 80933edfe..21acfb6dc 100644 --- a/src/app/paths/Paths.cpp +++ b/src/app/paths/Paths.cpp @@ -113,15 +113,19 @@ static inline string getWritableFilePath (const QString &filename) { // lib64/ // share/ +// On Mac, we have : +// Contents/ +// Frameworks/ +// MacOs/linphone +// Plugins/ +// Resources/ +// share/ + static inline QDir getAppPackageDir () { QDir dir(QCoreApplication::applicationDirPath()); if (dir.dirName() == QLatin1String("MacOS")) { dir.cdUp(); - if (!dir.cd("Resources")) - { - dir.mkdir("Resources"); - dir.cd("Resources"); - } + } else if( !dir.exists("lib") && !dir.exists("lib64")){// Check if these folders are in the current path dir.cdUp(); if(!dir.exists("lib") && !dir.exists("lib64")) @@ -132,6 +136,11 @@ static inline QDir getAppPackageDir () { static inline QString getAppPackageDataDirPath() { QDir dir = getAppPackageDir(); + if (!dir.cd("Resources")) + { + dir.mkdir("Resources"); + dir.cd("Resources"); + } if (!dir.cd("share")) { dir.mkdir("share");