From 62ba5767cc3a6cf7283aa2c1c8b22c1a2ed01759 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Mon, 5 May 2008 23:53:12 +0300 Subject: [PATCH] Add config_GetConfDir --- include/vlc_configuration.h | 1 + src/Makefile.am | 1 + src/config/core.c | 24 ++++++++++++++++++++++++ src/libvlc.sym | 1 + 4 files changed, 27 insertions(+) diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h index 076d02cff8..0d94ad9ea9 100644 --- a/include/vlc_configuration.h +++ b/include/vlc_configuration.h @@ -215,6 +215,7 @@ VLC_EXPORT( void, __config_ResetAll, ( vlc_object_t * ) ); VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) ); VLC_EXPORT(const char *, config_GetDataDir, ( void )); +VLC_EXPORT(const char *, config_GetConfDir, ( void ) ); VLC_EXPORT(char *, config_GetUserConfDir, ( void ) ); VLC_EXPORT(char *, config_GetUserDataDir, ( void ) ); VLC_EXPORT(char *, config_GetCacheDir, ( void ) ); diff --git a/src/Makefile.am b/src/Makefile.am index 5c548227e1..ac8d47baf6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -172,6 +172,7 @@ libvlc_la_SOURCES = $(SOURCES_libvlc) nodist_libvlc_la_SOURCES = misc/revision.c libvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags libvlc` \ -DLOCALEDIR=\"$(localedir)\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ -DDATA_PATH=\"$(pkgdatadir)\" \ -DPLUGIN_PATH=\"$(pkglibdir)\" libvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags libvlc` diff --git a/src/config/core.c b/src/config/core.c index 7a81888950..7df48ae73a 100644 --- a/src/config/core.c +++ b/src/config/core.c @@ -621,6 +621,30 @@ const char *config_GetDataDir( void ) #endif } +/** + * Determines the system configuration directory. + * + * @return a string (always succeeds). + */ +const char *config_GetConfDir( void ) +{ +#if defined (WIN32) || defined (UNDER_CE) + return vlc_global()->psz_vlcpath; +#elif defined(__APPLE__) || defined (SYS_BEOS) + static char path[PATH_MAX] = ""; + + if( *path == '\0' ) + { + snprintf( path, sizeof( path ), "%s/share", /* FIXME: Duh? */ + vlc_global()->psz_vlcpath ); + path[sizeof( path ) - 1] = '\0'; + } + return path; +#else + return SYSCONFDIR; +#endif +} + static char *GetDir( bool b_appdata ) { const char *psz_localhome = NULL; diff --git a/src/libvlc.sym b/src/libvlc.sym index 964f243256..ac448a9c19 100644 --- a/src/libvlc.sym +++ b/src/libvlc.sym @@ -51,6 +51,7 @@ __config_ChainParse __config_ExistIntf config_FindConfig config_GetCacheDir +config_GetConfDir config_GetDataDir __config_GetFloat __config_GetInt -- 2.39.2