+#if defined(WIN32)
+ char path[1024];
+ DWORD size = sizeof( path );
+ GetModuleFileName( NULL, path, size );
+#elif defined(__DARWIN__) && defined(RELOCATABLE)
+ char path[1024];
+ uint32_t size = sizeof( path );
+ _NSGetExecutablePath( path, &size );
+#endif
+#if defined(WIN32) || (defined(__DARWIN__) && defined(RELOCATABLE))
+ char *path2 = strdup( path );
+ char *appdir = dirname( path2 );
+ mlt_properties_set( global_properties, "MLT_APPDIR", appdir );
+ free( path2 );
+#endif