From fb347c3c62ced2ea302769e449d300fd923c2d4b Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Thu, 14 Jan 2021 17:34:21 +0300 Subject: [PATCH] UI: Add support for OBS_PLUGINS*_PATH env variables Allow to load obs plugins from arbitary directory, specified by OBS_PLUGINS_PATH and OBS_PLUGINS_DATA_PATH environment variables. --- UI/window-basic-main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index ad5cb578ec143..b3e2742ad50a5 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -136,6 +136,16 @@ template static void SetOBSRef(QListWidgetItem *item, T &&val) static void AddExtraModulePaths() { + char *plugins_path = getenv("OBS_PLUGINS_PATH"); + char *plugins_data_path = getenv("OBS_PLUGINS_DATA_PATH"); + if (plugins_path && plugins_data_path) { + 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, + data_path_with_module_suffix.c_str()); + } + char base_module_dir[512]; #if defined(_WIN32) || defined(__APPLE__) int ret = GetProgramDataPath(base_module_dir, sizeof(base_module_dir),