| 1 | From f77bb3648eb998b9225499f85463fcbbda305474 Mon Sep 17 00:00:00 2001
|
| 2 | From: Alexey Abramov <[email protected]>
|
| 3 | Date: Sat, 19 Jul 2025 11:08:04 +0200
|
| 4 | Subject: [PATCH] Use environment variable for a default module location
|
| 5 |
|
| 6 | diff --git a/libobs/obs-nix.c b/libobs/obs-nix.c
|
| 7 | index d28269687..a0950a0b1 100644
|
| 8 | |
| 9 | |
| 10 | @@ -67,26 +67,18 @@ static const struct obs_nix_hotkeys_vtable *hotkeys_vtable = NULL;
|
| 11 |
|
| 12 | void add_default_module_paths(void)
|
| 13 | {
|
| 14 | - char *module_bin_path = os_get_executable_path_ptr("../" OBS_PLUGIN_PATH);
|
| 15 | - char *module_data_path = os_get_executable_path_ptr("../" OBS_DATA_PATH "/obs-plugins/%module%");
|
| 16 | + char *bin_directory = getenv("OBS_PLUGINS_DIRECTORY");
|
| 17 | + char *data_directory = getenv("OBS_PLUGINS_DATA_DIRECTORY");
|
| 18 | + if (bin_directory && data_directory) {
|
| 19 | + struct dstr dstr_data_directory;
|
| 20 | + dstr_init_copy(&dstr_data_directory, data_directory);
|
| 21 | + dstr_cat(&dstr_data_directory, "/%module%");
|
| 22 | + obs_add_module_path(bin_directory, dstr_data_directory.array);
|
| 23 | + dstr_free(&dstr_data_directory);
|
| 24 |
|
| 25 | - if (module_bin_path && module_data_path) {
|
| 26 | - char *abs_module_bin_path = os_get_abs_path_ptr(module_bin_path);
|
| 27 | - char *abs_module_install_path = os_get_abs_path_ptr(OBS_INSTALL_PREFIX "/" OBS_PLUGIN_DESTINATION);
|
| 28 | -
|
| 29 | - if (abs_module_bin_path &&
|
| 30 | - (!abs_module_install_path || strcmp(abs_module_bin_path, abs_module_install_path) != 0)) {
|
| 31 | - obs_add_module_path(module_bin_path, module_data_path);
|
| 32 | - }
|
| 33 | - bfree(abs_module_install_path);
|
| 34 | - bfree(abs_module_bin_path);
|
| 35 | - }
|
| 36 | -
|
| 37 | - bfree(module_bin_path);
|
| 38 | - bfree(module_data_path);
|
| 39 | -
|
| 40 | - for (int i = 0; i < module_patterns_size; i++) {
|
| 41 | - obs_add_module_path(module_bin[i], module_data[i]);
|
| 42 | + } else {
|
| 43 | + for (int i = 0; i < module_patterns_size; i++)
|
| 44 | + obs_add_module_path(module_bin[i], module_data[i]);
|
| 45 | }
|
| 46 | }
|
| 47 |
|
| 48 | --
|
| 49 | 2.50.1
|
| 50 |
|