Changeset 889c73d0f220a2366abd0a72e591cf8221433c28
- 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
| r38d2803 |
r889c73d |
|
| 986 | 986 | #define PLUGIN_PATH_TEXT N_("Modules search path") |
|---|
| 987 | 987 | #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") |
|---|
| 989 | 990 | |
|---|
| 990 | 991 | #define VLM_CONF_TEXT N_("VLM configuration file") |
|---|
| r16afc89 |
r889c73d |
|
| 913 | 913 | static void AllocateAllPlugins( vlc_object_t *p_this ) |
|---|
| 914 | 914 | { |
|---|
| 915 | | /* Yes, there are two NULLs because we replace one with "plugin-path". */ |
|---|
| | 915 | char *path, *ppsz_path, *psz_iter; |
|---|
| | 916 | |
|---|
| 916 | 917 | #if defined( WIN32 ) || defined( UNDER_CE ) |
|---|
| 917 | | const char *path[] = { "modules", "", "plugins", NULL, NULL }; |
|---|
| | 918 | const char * extra_path = ""; |
|---|
| 918 | 919 | #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 |
|---|
| 923 | 922 | |
|---|
| 924 | 923 | /* 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; ) |
|---|
| 929 | 938 | { |
|---|
| 930 | 939 | char *psz_fullpath; |
|---|
| 931 | 940 | |
|---|
| 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; |
|---|
| 933 | 945 | |
|---|
| 934 | 946 | #if defined( SYS_BEOS ) || defined( __APPLE__ ) || defined( WIN32 ) |
|---|
| … | … | |
| 936 | 948 | /* Handle relative as well as absolute paths */ |
|---|
| 937 | 949 | #ifdef WIN32 |
|---|
| 938 | | if( (*ppsz_path)[0] != '\\' && (*ppsz_path)[0] != '/' && |
|---|
| 939 | | (*ppsz_path)[1] != ':' ) |
|---|
| | 950 | if( ppsz_path[0] != '\\' && ppsz_path[0] != '/' ) |
|---|
| 940 | 951 | #else |
|---|
| 941 | | if( (*ppsz_path)[0] != '/' ) |
|---|
| | 952 | if( ppsz_path[0] != '/' ) |
|---|
| 942 | 953 | #endif |
|---|
| 943 | 954 | { |
|---|
| 944 | 955 | if( 0>= asprintf( &psz_fullpath, "%s"DIR_SEP"%s", |
|---|
| 945 | | vlc_global()->psz_vlcpath, *ppsz_path) ) |
|---|
| | 956 | vlc_global()->psz_vlcpath, ppsz_path) ) |
|---|
| 946 | 957 | psz_fullpath = NULL; |
|---|
| 947 | 958 | } |
|---|
| 948 | 959 | else |
|---|
| 949 | 960 | #endif |
|---|
| 950 | | psz_fullpath = strdup( *ppsz_path ); |
|---|
| | 961 | psz_fullpath = strdup( ppsz_path ); |
|---|
| 951 | 962 | |
|---|
| 952 | 963 | if( psz_fullpath == NULL ) |
|---|
| … | … | |
| 959 | 970 | |
|---|
| 960 | 971 | free( psz_fullpath ); |
|---|
| | 972 | if( !end ) ppsz_path = psz_iter + 1; |
|---|
| 961 | 973 | } |
|---|
| 962 | 974 | |
|---|
| 963 | 975 | /* Free plugin-path */ |
|---|
| 964 | | free( userpath ); |
|---|
| | 976 | free( path ); |
|---|
| 965 | 977 | } |
|---|
| 966 | 978 | |
|---|