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

Use config_GetUserConfDir internally too

parent 75c438d3
...@@ -92,7 +92,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode ) ...@@ -92,7 +92,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode )
"version 0.6. Your\nconfiguration has been " "version 0.6. Your\nconfiguration has been "
"copied to the new location:\n%s\nYou can " "copied to the new location:\n%s\nYou can "
"delete this directory and all its contents.", "delete this directory and all its contents.",
libvlc_priv(p_obj->p_libvlc)->psz_configdir); psz_filename);
fclose( p_readme ); fclose( p_readme );
} }
free( psz_readme ); free( psz_readme );
...@@ -401,8 +401,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, ...@@ -401,8 +401,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
if( libvlc_priv (p_this->p_libvlc)->psz_configfile == NULL ) if( libvlc_priv (p_this->p_libvlc)->psz_configfile == NULL )
{ {
const char *psz_configdir = char *psz_configdir = config_GetUserConfDir();
libvlc_priv(p_this->p_libvlc)->psz_configdir;
if( !psz_configdir ) /* XXX: This should never happen */ if( !psz_configdir ) /* XXX: This should never happen */
{ {
msg_Err( p_this, "no configuration directory defined" ); msg_Err( p_this, "no configuration directory defined" );
...@@ -411,6 +410,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, ...@@ -411,6 +410,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
} }
config_CreateDir( p_this, psz_configdir ); config_CreateDir( p_this, psz_configdir );
free( psz_configdir );
} }
file = config_OpenConfigFile( p_this, "rt" ); file = config_OpenConfigFile( p_this, "rt" );
...@@ -670,10 +670,12 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name ) ...@@ -670,10 +670,12 @@ int __config_SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name )
*/ */
char *config_GetConfigFile( libvlc_int_t *p_libvlc ) char *config_GetConfigFile( libvlc_int_t *p_libvlc )
{ {
char *psz_dir = config_GetUserConfDir();
char *psz_configfile; char *psz_configfile;
if( asprintf( &psz_configfile, "%s" DIR_SEP CONFIG_FILE,
libvlc_priv (p_libvlc)->psz_configdir ) == -1 ) if( asprintf( &psz_configfile, "%s" DIR_SEP CONFIG_FILE, psz_dir ) == -1 )
return NULL; psz_configfile = NULL;
free( psz_dir );
return psz_configfile; return psz_configfile;
} }
......
...@@ -296,7 +296,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, ...@@ -296,7 +296,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/* Set the config file stuff */ /* Set the config file stuff */
p_libvlc->psz_homedir = config_GetHomeDir(); p_libvlc->psz_homedir = config_GetHomeDir();
priv->psz_configdir = config_GetUserConfDir();
priv->psz_datadir = config_GetUserDataDir(); priv->psz_datadir = config_GetUserDataDir();
priv->psz_configfile = config_GetCustomConfigFile( p_libvlc ); priv->psz_configfile = config_GetCustomConfigFile( p_libvlc );
...@@ -1061,7 +1060,6 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, bool b_release ) ...@@ -1061,7 +1060,6 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, bool b_release )
module_EndBank( p_libvlc ); module_EndBank( p_libvlc );
FREENULL( p_libvlc->psz_homedir ); FREENULL( p_libvlc->psz_homedir );
free( priv->psz_configdir );
free( priv->psz_datadir ); free( priv->psz_datadir );
FREENULL( priv->psz_configfile ); FREENULL( priv->psz_configfile );
var_DelCallback( p_libvlc, "key-pressed", vlc_key_to_action, var_DelCallback( p_libvlc, "key-pressed", vlc_key_to_action,
......
...@@ -211,7 +211,6 @@ typedef struct libvlc_priv_t ...@@ -211,7 +211,6 @@ typedef struct libvlc_priv_t
/* Configuration */ /* Configuration */
vlc_mutex_t config_lock; ///< config file lock vlc_mutex_t config_lock; ///< config file lock
char * psz_configfile; ///< location of config file char * psz_configfile; ///< location of config file
char *psz_configdir; ///< user configuration directory
char *psz_datadir; ///< user data directory char *psz_datadir; ///< user data directory
/* There is no real reason to keep a list of items, but not to break /* There is no real reason to keep a list of items, but not to break
......
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