Changeset 889c73d0f220a2366abd0a72e591cf8221433c28

Show
Ignore:
Timestamp:
28/03/08 12:18:44 (7 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1206703124 +0100
git-parent:

[21f7e7ea477453871b494758c2dec31e0c23287c]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1206701960 +0100
Message:

module: Allow multiple paths in --plugin-path (Separated by ':').

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/libvlc-module.c

    r38d2803 r889c73d  
    986986#define PLUGIN_PATH_TEXT N_("Modules search path") 
    987987#define PLUGIN_PATH_LONGTEXT N_( \ 
    988     "Additional path for VLC to look for its modules.") 
     988    "Additional path for VLC to look for its modules. You can add " \ 
     989    "several paths by concatenating them using ':' as separator") 
    989990 
    990991#define VLM_CONF_TEXT N_("VLM configuration file") 
  • src/modules/modules.c

    r16afc89 r889c73d  
    913913static void AllocateAllPlugins( vlc_object_t *p_this ) 
    914914{ 
    915     /* Yes, there are two NULLs because we replace one with "plugin-path". */ 
     915    char *path, *ppsz_path, *psz_iter; 
     916 
    916917#if defined( WIN32 ) || defined( UNDER_CE ) 
    917     const char *path[] = { "modules", "", "plugins", NULL, NULL }
     918    const char * extra_path = ""
    918919#else 
    919     const char *path[] = { "modules", PLUGIN_PATH, "plugins", NULL, NULL }; 
    920 #endif 
    921  
    922     const char *const *ppsz_path; 
     920    const char * extra_path = PLUGIN_PATH; 
     921#endif 
    923922 
    924923    /* If the user provided a plugin path, we add it to the list */ 
    925     char *userpath = config_GetPsz( p_this, "plugin-path" ); 
    926     path[sizeof(path)/sizeof(path[0]) - 2] = userpath; 
    927  
    928     for( ppsz_path = path; *ppsz_path != NULL; ppsz_path++ ) 
     924    char * userpath = config_GetPsz( p_this, "plugin-path" ); 
     925    bool end = false; 
     926 
     927    if( asprintf( &path, "modules%s:plugins:%s", extra_path, userpath ) < 0 ) 
     928    { 
     929        msg_Err( p_this, "Not enough memory" ); 
     930        free( userpath ); 
     931        return; 
     932    } 
     933 
     934    /* Free plugin-path */ 
     935    free( userpath ); 
     936 
     937    for( ppsz_path = path; !end; ) 
    929938    { 
    930939        char *psz_fullpath; 
    931940 
    932         if( !**ppsz_path ) continue; 
     941        /* Look for a ':' */ 
     942        for( psz_iter = ppsz_path; *psz_iter && *psz_iter != ':'; psz_iter++ ); 
     943        if( !*psz_iter ) end = true; 
     944        else *psz_iter = 0; 
    933945 
    934946#if defined( SYS_BEOS ) || defined( __APPLE__ ) || defined( WIN32 ) 
     
    936948        /* Handle relative as well as absolute paths */ 
    937949#ifdef WIN32 
    938         if( (*ppsz_path)[0] != '\\' && (*ppsz_path)[0] != '/' && 
    939             (*ppsz_path)[1] != ':' ) 
     950        if( ppsz_path[0] != '\\' && ppsz_path[0] != '/' ) 
    940951#else 
    941         if( (*ppsz_path)[0] != '/' ) 
     952        if( ppsz_path[0] != '/' ) 
    942953#endif 
    943954        { 
    944955            if( 0>= asprintf( &psz_fullpath, "%s"DIR_SEP"%s", 
    945                               vlc_global()->psz_vlcpath, *ppsz_path) ) 
     956                              vlc_global()->psz_vlcpath, ppsz_path) ) 
    946957                psz_fullpath = NULL; 
    947958        } 
    948959        else 
    949960#endif 
    950             psz_fullpath = strdup( *ppsz_path ); 
     961            psz_fullpath = strdup( ppsz_path ); 
    951962 
    952963        if( psz_fullpath == NULL ) 
     
    959970 
    960971        free( psz_fullpath ); 
     972        if( !end ) ppsz_path = psz_iter + 1; 
    961973    } 
    962974 
    963975    /* Free plugin-path */ 
    964     free( userpath ); 
     976    free( path ); 
    965977} 
    966978