[vlc-devel] commit: Add config_GetConfDir ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon May 5 22:53:59 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Mon May  5 23:53:12 2008 +0300| [62ba5767cc3a6cf7283aa2c1c8b22c1a2ed01759]

Add config_GetConfDir

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62ba5767cc3a6cf7283aa2c1c8b22c1a2ed01759
---

 include/vlc_configuration.h |    1 +
 src/Makefile.am             |    1 +
 src/config/core.c           |   24 ++++++++++++++++++++++++
 src/libvlc.sym              |    1 +
 4 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index 076d02c..0d94ad9 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 5c54822..ac8d47b 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 7a81888..7df48ae 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 964f243..ac448a9 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




More information about the vlc-devel mailing list