From 7ffc38ebb6668562d3514240be2a14ddc001ccc7 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Thu, 31 Oct 2024 18:16:28 +0100 Subject: [PATCH] UI: Fix broken module paths provided via environment on macOS When custom module and module data paths are provided via environment variables, the module paths generated by current code will not be compatible with the plugin bundle structure used on macOS. Using environment variables is a simple way to test plugins, as this allows OBS to discover them from alternative user-provided locations. --- UI/window-basic-main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index bbc3e6cb3dda67..47cac8dccfe7cc 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -181,10 +181,16 @@ static void AddExtraModulePaths() plugins_data_path = s; if (!plugins_path.empty() && !plugins_data_path.empty()) { +#if defined(__APPLE__) + plugins_path += "/%module%.plugin/Contents/MacOS"; + plugins_data_path += "/%module%.plugin/Contents/Resources"; + obs_add_module_path(plugins_path.c_str(), plugins_data_path.c_str()); +#else string data_path_with_module_suffix; data_path_with_module_suffix += plugins_data_path; data_path_with_module_suffix += "/%module%"; obs_add_module_path(plugins_path.c_str(), data_path_with_module_suffix.c_str()); +#endif } if (portable_mode)