]> git.sesse.net Git - mlt/commitdiff
Fix build on win32
authorDan Dennedy <dan@dennedy.org>
Sun, 25 Sep 2011 23:14:23 +0000 (16:14 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 25 Sep 2011 23:14:23 +0000 (16:14 -0700)
src/framework/Makefile
src/framework/mlt_factory.c
src/framework/mlt_profile.c

index e487c9aa7d52b2454d8b57df5fa6e6de001ff995..004d3e5ad21f05f5f56cd42ecf8d769b7761e1a3 100644 (file)
@@ -78,7 +78,7 @@ OBJS += ../win32/win32.o
 SRCS += ../win32/win32.c
 endif
 
-CFLAGS += $(RDYNAMIC) -DPREFIX="\"$(prefix)\"" -DLIBDIR="\"$(libdir)\"" -DDATADIR="\"$(datadir)\""
+CFLAGS += $(RDYNAMIC) -DPREFIX="\"$(prefix)\"" -DLIBDIR="\"$(libdir)\"" -DMLTDATADIR="\"$(datadir)\""
 
 LDFLAGS += $(LIBDL) -lpthread
 
index 76f3f5c620f087976a16901c297cfc20f1d4add8..cd298bc7fbce26dca31e6a3378ea231bcf01fb96 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <locale.h>
+#include <libgen.h>
 
 #ifdef WIN32
 #include <windows.h>
@@ -36,7 +37,6 @@
 #define PREFIX_DATA "\\share\\mlt"
 #elif defined(__DARWIN__) && defined(RELOCATABLE)
 #include <mach-o/dyld.h>
-#include <libgen.h>
 /** the default subdirectory of the libdir for holding modules (plugins) */
 #define PREFIX_LIB "/lib/mlt"
 /** the default subdirectory of the install prefix for holding module (plugin) data */
@@ -45,7 +45,7 @@
 /** the default subdirectory of the libdir for holding modules (plugins) */
 #define PREFIX_LIB LIBDIR "/mlt"
 /** the default subdirectory of the install prefix for holding module (plugin) data */
-#define PREFIX_DATA DATADIR "/mlt"
+#define PREFIX_DATA MLTDATADIR "/mlt"
 #endif
 
 /** holds the full path to the modules directory - initialized and retained for the entire session */
@@ -141,9 +141,9 @@ mlt_repository mlt_factory_init( const char *directory )
 
                // Store the prefix for later retrieval
 #if defined(WIN32)
-               LPTSTR path[1024];
+               char path[1024];
                DWORD size = sizeof( path );
-               GetModuleFileName( NULL, path, &size );
+               GetModuleFileName( NULL, path, size );
 #elif defined(__DARWIN__)  && defined(RELOCATABLE)
                char path[1024];
                uint32_t size = sizeof( path );
@@ -152,17 +152,20 @@ mlt_repository mlt_factory_init( const char *directory )
                mlt_directory = strdup( directory );
 #endif
 #if defined(WIN32) || (defined(__DARWIN__) && defined(RELOCATABLE))
+               char *path2 = strdup( path );
+               char *exedir = dirname( path2 );
                if ( global_properties && !getenv( "MLT_DATA" ) )
                {
                        mlt_directory = calloc( 1, size + strlen( PREFIX_DATA ) + 1 );
-                       strcpy( mlt_directory, dirname( path ) );
+                       strcpy( mlt_directory, exedir );
                        strcat( mlt_directory, PREFIX_DATA );
                        mlt_properties_set( global_properties, "MLT_DATA", mlt_directory );
                        free( mlt_directory );
                }
                mlt_directory = calloc( 1, size + strlen( directory ) + 1 );
-               strcpy( mlt_directory, dirname( path ) );
+               strcpy( mlt_directory, exedir );
                strcat( mlt_directory, directory );
+               free( path2 );
 #endif
                
                // Initialise the pool
index 9e3b7ce344fa07a5ac3fbf5cacfbb043275c2fdf..f0fc02c58c3817a1235de5c8b01e393b884665a6 100644 (file)
@@ -56,7 +56,7 @@ static mlt_profile mlt_profile_select( const char *name )
        // Load from $datadir/mlt/profiles
        else if ( prefix == NULL )
        {
-               prefix = DATADIR;
+               prefix = MLTDATADIR;
                filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + strlen( name ) + 1 );
                strcpy( filename, prefix );
                strcat( filename, PROFILES_DIR );