]> git.sesse.net Git - mlt/commitdiff
mlt_profle.c: add support for MLT_PROFILES_DIR environment variable
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 13 Oct 2007 06:02:44 +0000 (06:02 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 13 Oct 2007 06:02:44 +0000 (06:02 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1028 d19143bc-622f-0410-bfdd-b5b2a6649095

setenv
src/framework/mlt_profile.c

diff --git a/setenv b/setenv
index c57b28ae7a92da309c498cd6e9969e030c68d396..dd38115741f14edaccf61466ad54b37be4ddb45f 100644 (file)
--- a/setenv
+++ b/setenv
@@ -2,6 +2,7 @@
 # Environment variable settings to allow execution without install
 
 export MLT_REPOSITORY=`pwd`/src/modules
+export MLT_PROFILES_PATH=`pwd`/profiles
 
 export LD_LIBRARY_PATH=\
 `pwd`/src/framework:\
index 8d0e07122317fd335f914ed08a07793c8281f90f..607af04c686899f34fbc568d0c832d7ca690991c 100644 (file)
@@ -63,12 +63,28 @@ mlt_profile mlt_profile_get( )
 
 mlt_profile mlt_profile_select( const char *name )
 {
-       const char *prefix = PREFIX;
-       char *filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + strlen( name ) + 2 );
-       strcpy( filename, prefix );
-       if ( filename[ strlen( filename ) - 1 ] != '/' )
-               filename[ strlen( filename ) ] = '/';
-       strcat( filename, PROFILES_DIR );
+       char *filename = NULL;
+       const char *prefix = getenv( "MLT_PROFILES_PATH" );
+       
+       // Allow environment to override default behavior
+       if ( prefix == NULL )
+       {
+               // default behavior is to use $prefix/share/mlt/profiles
+               prefix = PREFIX;
+               filename = calloc( 1, strlen( prefix ) + strlen( PROFILES_DIR ) + strlen( name ) + 2 );
+               strcpy( filename, prefix );
+               if ( filename[ strlen( filename ) - 1 ] != '/' )
+                       filename[ strlen( filename ) ] = '/';
+               strcat( filename, PROFILES_DIR );
+       }
+       else
+       {
+               // just use environment variable
+               filename = calloc( 1, strlen( prefix ) + strlen( name ) + 2 );
+               strcpy( filename, prefix );
+               if ( filename[ strlen( filename ) - 1 ] != '/' )
+                       filename[ strlen( filename ) ] = '/';
+       }
        strcat( filename, name );
        return mlt_profile_load_file( filename );
 }