From 08fe82b877f4fc96dc4509b6e34a30a6dc844643 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Fri, 29 Jul 2022 10:39:16 +0200 Subject: [PATCH] darwin: redirect VLC_PKG_LIB_DIR/plugins on iOS On iOS and tvOS, dylibs must be wrapped into a framework and frameworks must be flattened into the frameworks/ application directory (or global to the system which is not possible in the general case), so dylibs can't be in the VLC_PKG_LIB_DIR/plugins folder. Redirect VLC_PKG_LIB_DIR/plugins toward VLC_PKG_LIB_DIR/ on those platforms. Manual cherry-pick from commit 89e90672db4a10243ae802c32272da8c062bc7bb. The code is written directly in the src/modules/bank.c code given that config_GetSysPath doesn't exist in 3.0. --- src/darwin/dirs.c | 1 + src/modules/bank.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/darwin/dirs.c b/src/darwin/dirs.c index d0489fd21c..5f0d2f2294 100644 --- a/src/darwin/dirs.c +++ b/src/darwin/dirs.c @@ -35,6 +35,7 @@ #include #include +#include char *config_GetLibDir (void) { diff --git a/src/modules/bank.c b/src/modules/bank.c index c6fb14db03..52037d5b59 100644 --- a/src/modules/bank.c +++ b/src/modules/bank.c @@ -49,6 +49,10 @@ #include "config/configuration.h" #include "modules/modules.h" +#ifdef __APPLE__ +#include +#endif + typedef struct vlc_modcap { char *name; @@ -525,6 +529,11 @@ static void AllocateAllPlugins (vlc_object_t *p_this) #if VLC_WINSTORE_APP /* Windows Store Apps can not load external plugins with absolute paths. */ AllocatePluginPath (p_this, "plugins", mode); +#elif defined(__APPLE__) && defined(HAVE_DYNAMIC_PLUGINS) && TARGET_OS_IPHONE + /* Redirect to the application folder, plugins/ is flattened. */ + char *vlcpath = config_GetLibDir (); + AllocatePluginPath (p_this, vlcpath, mode); + free(vlcpath); #else /* Contruct the special search path for system that have a relocatable * executable. Set it to /plugins. */