Commit cfe59a4f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

config_GetDataDir(): returns path to VLC installed shared data

parent b17c9671
...@@ -181,6 +181,7 @@ VLC_EXPORT( void, __config_PutPsz, (vlc_object_t *, const char *, const char ...@@ -181,6 +181,7 @@ VLC_EXPORT( void, __config_PutPsz, (vlc_object_t *, const char *, const char
VLC_EXPORT( int, __config_LoadCmdLine, ( vlc_object_t *, int *, char *[], vlc_bool_t ) ); VLC_EXPORT( int, __config_LoadCmdLine, ( vlc_object_t *, int *, char *[], vlc_bool_t ) );
VLC_EXPORT( char *, config_GetHomeDir, ( void ) ); VLC_EXPORT( char *, config_GetHomeDir, ( void ) );
VLC_EXPORT( char *, config_GetUserDir, ( void ) ); VLC_EXPORT( char *, config_GetUserDir, ( void ) );
VLC_EXPORT( const char *, config_GetDataDir, ( const vlc_object_t * ) );
VLC_EXPORT( int, __config_LoadConfigFile, ( vlc_object_t *, const char * ) ); VLC_EXPORT( int, __config_LoadConfigFile, ( vlc_object_t *, const char * ) );
VLC_EXPORT( int, __config_SaveConfigFile, ( vlc_object_t *, const char * ) ); VLC_EXPORT( int, __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) ); VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) );
......
...@@ -476,6 +476,7 @@ struct module_symbols_t ...@@ -476,6 +476,7 @@ struct module_symbols_t
int (*utf8_mkdir_inner) (const char *filename); int (*utf8_mkdir_inner) (const char *filename);
vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *); vlm_media_t* (*vlm_MediaSearch_inner) (vlm_t *, const char *);
int (*playlist_TreeMove_inner) (playlist_t *, playlist_item_t *, playlist_item_t *, int, int); int (*playlist_TreeMove_inner) (playlist_t *, playlist_item_t *, playlist_item_t *, int, int);
const char * (*config_GetDataDir_inner) (const vlc_object_t *);
}; };
# if defined (__PLUGIN__) # if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner # define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...@@ -932,6 +933,7 @@ struct module_symbols_t ...@@ -932,6 +933,7 @@ struct module_symbols_t
# define utf8_mkdir (p_symbols)->utf8_mkdir_inner # define utf8_mkdir (p_symbols)->utf8_mkdir_inner
# define vlm_MediaSearch (p_symbols)->vlm_MediaSearch_inner # define vlm_MediaSearch (p_symbols)->vlm_MediaSearch_inner
# define playlist_TreeMove (p_symbols)->playlist_TreeMove_inner # define playlist_TreeMove (p_symbols)->playlist_TreeMove_inner
# define config_GetDataDir (p_symbols)->config_GetDataDir_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__) # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/****************************************************************** /******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access. * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...@@ -1391,6 +1393,7 @@ struct module_symbols_t ...@@ -1391,6 +1393,7 @@ struct module_symbols_t
((p_symbols)->utf8_mkdir_inner) = utf8_mkdir; \ ((p_symbols)->utf8_mkdir_inner) = utf8_mkdir; \
((p_symbols)->vlm_MediaSearch_inner) = vlm_MediaSearch; \ ((p_symbols)->vlm_MediaSearch_inner) = vlm_MediaSearch; \
((p_symbols)->playlist_TreeMove_inner) = playlist_TreeMove; \ ((p_symbols)->playlist_TreeMove_inner) = playlist_TreeMove; \
((p_symbols)->config_GetDataDir_inner) = config_GetDataDir; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \ (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__stats_CounterGet_deprecated = NULL; \ (p_symbols)->__stats_CounterGet_deprecated = NULL; \
(p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \ (p_symbols)->__stats_TimerDumpAll_deprecated = NULL; \
......
...@@ -1676,6 +1676,30 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], ...@@ -1676,6 +1676,30 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
return 0; return 0;
} }
/**
* config_GetDataDir: find directory where shared data is installed
*
* @return a string (always succeeds).
*/
const char *config_GetDataDir( const vlc_object_t *p_this )
{
#if defined (WIN32) || defined (UNDER_CE)
return p_this->p_libvlc->psz_vlcpath;
#elif defined(__APPLE__) || defined (SYS_BEOS)
static char path[PATH_MAX] = "";
if( *path == '\0' )
{
snprintf( path, sizeof( path ), "%s/share",
p_this->p_libvlc->psz_vlcpath );
path[sizeof( path ) - 1] = '\0';
}
return path;
#else
return DATA_PATH;
#endif
}
/***************************************************************************** /*****************************************************************************
* config_GetHomeDir, config_GetUserDir: find the user's home directory. * config_GetHomeDir, config_GetUserDir: find the user's home directory.
***************************************************************************** *****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment