79 lines
2.6 KiB
Diff
79 lines
2.6 KiB
Diff
From 199eb959261708c7be7f94b72dffbac7527587fd Mon Sep 17 00:00:00 2001
|
|
From: Ivan Yossi <ghevan@gmail.com>
|
|
Date: Fri, 26 Jan 2024 19:57:17 +0100
|
|
Subject: [PATCH 1/4] MacOS: allow finding plugins outside bundles
|
|
|
|
This allows to load mlt plugins from install directory when the
|
|
.app is missing Plugins and Resources locations.
|
|
|
|
The patch is not robust, its designed to change from one static
|
|
location to another when running krita.app from a kritadev environment
|
|
when the bundle dirs are missing: this only happens when running
|
|
krita.app from install directory after building.
|
|
|
|
changes are:
|
|
i/bin/krita.app/Contents/Plugins/mlt -> i/lib/mlt
|
|
i/bin/krita.app/Contents/Resources/mlt -> i/share/mlt
|
|
---
|
|
src/framework/mlt_factory.c | 25 +++++++++++++++++++++++++
|
|
1 file changed, 25 insertions(+)
|
|
|
|
diff --git a/src/framework/mlt_factory.c b/src/framework/mlt_factory.c
|
|
index 40d8dec6..e5941bae 100644
|
|
--- a/src/framework/mlt_factory.c
|
|
+++ b/src/framework/mlt_factory.c
|
|
@@ -52,6 +52,7 @@
|
|
#endif
|
|
#ifdef __APPLE__
|
|
#include <mach-o/dyld.h>
|
|
+#include <dirent.h>
|
|
/** the default subdirectory of the libdir for holding modules (plugins) */
|
|
#define PREFIX_LIB "/PlugIns/mlt"
|
|
/** the default subdirectory of the install prefix for holding module (plugin) data */
|
|
@@ -64,6 +65,24 @@
|
|
#endif
|
|
#endif
|
|
|
|
+#ifdef __APPLE__
|
|
+void mlt_apple_relocate_mltdirectory(char **path, char* basepath, char* altpath)
|
|
+{
|
|
+ DIR *pdir = opendir(*path);
|
|
+
|
|
+ if ( !pdir ) {
|
|
+ memset(*path,0,strlen(*path));
|
|
+
|
|
+ size_t size = strlen(basepath);
|
|
+ strncpy( *path, basepath, size - 23);
|
|
+ strcat( *path, altpath);
|
|
+ } else {
|
|
+ closedir(pdir);
|
|
+ }
|
|
+ return;
|
|
+}
|
|
+#endif
|
|
+
|
|
/** holds the full path to the modules directory - initialized and retained for the entire session */
|
|
static char *mlt_directory = NULL;
|
|
/** a global properties list for holding environment config data and things needing session-oriented cleanup */
|
|
@@ -185,12 +204,18 @@ mlt_repository mlt_factory_init(const char *directory)
|
|
mlt_directory = calloc(1, size + strlen(PREFIX_DATA) + 1);
|
|
strcpy(mlt_directory, exedir);
|
|
strcat(mlt_directory, PREFIX_DATA);
|
|
+#ifdef __APPLE__
|
|
+ mlt_apple_relocate_mltdirectory(&mlt_directory, exedir, "/share/mlt");
|
|
+#endif
|
|
mlt_properties_set(global_properties, "MLT_DATA", mlt_directory);
|
|
free(mlt_directory);
|
|
}
|
|
mlt_directory = calloc(1, size + strlen(PREFIX_LIB) + 1);
|
|
strcpy(mlt_directory, exedir);
|
|
strcat(mlt_directory, PREFIX_LIB);
|
|
+#ifdef __APPLE__
|
|
+ mlt_apple_relocate_mltdirectory(&mlt_directory, exedir, "/lib/mlt");
|
|
+#endif
|
|
}
|
|
#endif
|
|
|
|
--
|
|
2.54.0
|
|
|