[vlc-devel] commit: Remove config_GetUserConfDir ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Aug 24 21:02:51 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 24 21:46:22 2009 +0300| [09bd8efc4011b0fc1ab42163a2d312c5daac63b2] | committer: Rémi Denis-Courmont 

Remove config_GetUserConfDir

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

 include/vlc_configuration.h  |    5 +++--
 modules/misc/lua/libs/misc.c |    2 +-
 src/config/dirs.c            |   19 ++++++++-----------
 src/config/file.c            |    6 +++---
 src/libvlccore.sym           |    1 -
 5 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/include/vlc_configuration.h b/include/vlc_configuration.h
index e5df206..30aa958 100644
--- a/include/vlc_configuration.h
+++ b/include/vlc_configuration.h
@@ -214,14 +214,15 @@ VLC_EXPORT( int,    __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
 VLC_EXPORT( void,   __config_ResetAll, ( vlc_object_t * ) );
 
 VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) LIBVLC_USED );
-
 VLC_EXPORT(const char *, config_GetDataDir, ( void ) LIBVLC_USED);
 VLC_EXPORT(const char *, config_GetConfDir, ( void ) LIBVLC_USED);
-VLC_EXPORT(char *, config_GetUserConfDir, ( void ) LIBVLC_USED);
 VLC_EXPORT(char *, config_GetUserDataDir, ( void ) LIBVLC_USED);
 
 typedef enum vlc_userdir {
+    /* User's home */
     VLC_HOME_DIR,
+    /* VLC configuration directory */
+    VLC_CONFIG_DIR,
 } vlc_userdir_t;
 
 VLC_EXPORT(char *, config_GetUserDir, ( vlc_userdir_t ) LIBVLC_USED);
diff --git a/modules/misc/lua/libs/misc.c b/modules/misc/lua/libs/misc.c
index 1bbc1b0..e080d27 100644
--- a/modules/misc/lua/libs/misc.c
+++ b/modules/misc/lua/libs/misc.c
@@ -134,7 +134,7 @@ static int vlclua_homedir( lua_State *L )
 
 static int vlclua_configdir( lua_State *L )
 {
-    char *dir = config_GetUserConfDir();
+    char *dir = config_GetUserDir( VLC_CONFIG_DIR );
     lua_pushstring( L, dir );
     free( dir );
     return 1;
diff --git a/src/config/dirs.c b/src/config/dirs.c
index 341fe00..e2a2ed8 100644
--- a/src/config/dirs.c
+++ b/src/config/dirs.c
@@ -249,14 +249,6 @@ static char *config_GetAppDir (const char *xdg_name, const char *xdg_default)
 }
 
 /**
- * Get the user's VLC configuration directory
- */
-char *config_GetUserConfDir( void )
-{
-    return config_GetAppDir ("CONFIG", ".config");
-}
-
-/**
  * Get the user's VLC data directory
  * (used for stuff like the skins, custom lua modules, ...)
  */
@@ -286,7 +278,12 @@ char *config_GetCacheDir( void )
 
 char *config_GetUserDir (vlc_userdir_t type)
 {
-    char *home = config_GetHomeDir ();
-    (void)type;
-    return home;
+    switch (type)
+    {
+        case VLC_HOME_DIR:
+            return config_GetHomeDir ();
+        case VLC_CONFIG_DIR:
+            return config_GetAppDir ("CONFIG", ".config");
+    }
+    assert (0);
 }
diff --git a/src/config/file.c b/src/config/file.c
index e1162bd..84ebec6 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -59,7 +59,7 @@ static char *config_GetConfigFile( vlc_object_t *obj )
     char *psz_file = config_GetPsz( obj, "config" );
     if( psz_file == NULL )
     {
-        char *psz_dir = config_GetUserConfDir();
+        char *psz_dir = config_GetUserDir( VLC_CONFIG_DIR );
 
         if( asprintf( &psz_file, "%s" DIR_SEP CONFIG_FILE, psz_dir ) == -1 )
             psz_file = NULL;
@@ -385,8 +385,8 @@ config_Write (FILE *file, const char *desc, const char *type,
 
 static int config_PrepareDir (vlc_object_t *obj)
 {
-    char *psz_configdir = config_GetUserConfDir ();
-    if (psz_configdir == NULL) /* XXX: This should never happen */
+    char *psz_configdir = config_GetUserDir (VLC_CONFIG_DIR);
+    if (psz_configdir == NULL)
         return -1;
 
     int ret = config_CreateDir (obj, psz_configdir);
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 4f567a9..4680bac 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -58,7 +58,6 @@ config_GetUserDir
 __config_GetInt
 __config_GetPsz
 __config_GetType
-config_GetUserConfDir
 config_GetUserDataDir
 __config_PutFloat
 __config_PutInt




More information about the vlc-devel mailing list