Browse Source

Add extra search path for third party plugins

The OBSBasic UI will now allow the use of a subdirectory of the user
application data directory for third-party plugins.  Though I'm not
entirely sure if this ideal or not.  Regardless, this is one of the
first (of many) steps towards a plugin manager.

On windows, this is %appdata%/obs-studio/plugins
On linux, this is ~/.obs-studio/plugins
On mac, this is ~/Library/Application Support/obs-sudio/plugins
jp9000 11 years ago
parent
commit
11c7e07eac
1 changed files with 11 additions and 0 deletions
  1. 11 0
      obs/window-basic-main.cpp

+ 11 - 0
obs/window-basic-main.cpp

@@ -57,6 +57,16 @@ Q_DECLARE_METATYPE(OBSScene);
 Q_DECLARE_METATYPE(OBSSceneItem);
 Q_DECLARE_METATYPE(order_movement);
 
+static void AddExtraModulePaths()
+{
+	BPtr<char> base_module_dir = os_get_config_path("plugins/%module%");
+	if (!base_module_dir)
+		return;
+
+	string path = (char*)base_module_dir;
+	obs_add_module_path((path + "/bin").c_str(), (path + "/data").c_str());
+}
+
 OBSBasic::OBSBasic(QWidget *parent)
 	: OBSMainWindow  (parent),
 	  ui             (new Ui::OBSBasic)
@@ -534,6 +544,7 @@ void OBSBasic::OBSInit()
 
 	InitOBSCallbacks();
 
+	AddExtraModulePaths();
 	obs_load_all_modules();
 
 	if (!InitOutputs())