return s;
}
- if( *psz_dir == '~' )
+ if( psz_dir[0] == '~' && psz_dir[1] == '/' )
{
/* This is incomplete : we should also support the ~cmassiot/ syntax. */
snprintf( dir, sizeof(dir), "%s/%s", p_intf->p_vlc->psz_homedir,
- psz_dir + 1 );
+ psz_dir + 2 );
psz_dir = dir;
}
}
free( psz_variable );
}
+ else if( !strcmp( s, "vlc_config_save" ) )
+ {
+ char *psz_module = SSPop( st );
+ int i_result;
+
+ if( !*psz_module )
+ {
+ free( psz_module );
+ psz_module = NULL;
+ }
+ i_result = config_SaveConfigFile( p_intf, psz_module );
+
+ if( psz_module != NULL )
+ free( psz_module );
+ SSPushN( st, i_result );
+ }
+ else if( !strcmp( s, "vlc_config_reset" ) )
+ {
+ config_ResetAll( p_intf );
+ }
/* 6. playlist functions */
else if( !strcmp( s, "playlist_add" ) )
{
/* Set the config file stuff */
p_vlc->psz_homedir = config_GetHomeDir();
p_vlc->psz_configfile = config_GetPsz( p_vlc, "config" );
+ if( p_vlc->psz_configfile != NULL && p_vlc->psz_configfile[0] == '~'
+ && p_vlc->psz_configfile[1] == '/' )
+ {
+ char *psz = malloc( strlen(p_vlc->psz_homedir)
+ + strlen(p_vlc->psz_configfile) );
+ /* This is incomplete : we should also support the ~cmassiot/ syntax. */
+ sprintf( psz, "%s/%s", p_vlc->psz_homedir,
+ p_vlc->psz_configfile + 2 );
+ free( p_vlc->psz_configfile );
+ p_vlc->psz_configfile = psz;
+ }
/* Check for plugins cache options */
if( config_GetInt( p_vlc, "reset-plugins-cache" ) )
* save.
* Really stupid no ?
*****************************************************************************/
-int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
- vlc_bool_t b_autosave )
+static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
+ vlc_bool_t b_autosave )
{
module_t *p_parser;
vlc_list_t *p_list;