Commit b61c8fde authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

libvlc: Add a --ignore-config options that allow not to use the config file....

libvlc: Add a --ignore-config options that allow not to use the config file. This is especially useful for libvlc based applications.
parent aae60936
......@@ -394,6 +394,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
# if defined (WIN32) || defined (__APPLE__)
/* This ain't really nice to have to reload the config here but it seems
* the only way to do it. */
if( !config_GetInt( p_libvlc, "ignore-config" ) )
config_LoadConfigFile( p_libvlc, "main" );
config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
......@@ -411,6 +413,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
module_EndBank( p_libvlc );
module_InitBank( p_libvlc );
if( !config_GetInt( p_libvlc, "ignore-config" ) )
config_LoadConfigFile( p_libvlc, "main" );
config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
p_libvlc_global->p_module_bank->b_cache_delete = b_cache_delete;
......@@ -465,6 +468,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
}
/* Check for config file options */
if( !config_GetInt( p_libvlc, "ignore-config" ) )
{
if( config_GetInt( p_libvlc, "reset-config" ) > 0 )
{
config_ResetAll( p_libvlc );
......@@ -477,6 +482,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
config_SaveConfigFile( p_libvlc, NULL );
}
}
if( b_exit )
{
......@@ -492,6 +498,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/*
* Override default configuration with config file settings
*/
if( !config_GetInt( p_libvlc, "ignore-config" ) )
config_LoadConfigFile( p_libvlc, NULL );
/*
......
......@@ -2446,6 +2446,8 @@ vlc_module_begin();
#define MODULE_TEXT \
N_("print help on a specific module (can be combined with --advanced " \
"and --help-verbose)")
#define IGNORE_CONFIG_TEXT \
N_("no configuration option will be loaded nor saved to config file")
#define SAVE_CONFIG_TEXT \
N_("save the current command line options in the config")
#define RESET_CONFIG_TEXT \
......@@ -2482,6 +2484,9 @@ vlc_module_begin();
change_short( 'p' );
change_internal();
change_unsaveable();
add_bool( "ignore-config", VLC_FALSE, NULL, IGNORE_CONFIG_TEXT, "", VLC_FALSE );
change_internal();
change_unsaveable();
add_bool( "save-config", VLC_FALSE, NULL, SAVE_CONFIG_TEXT, "",
VLC_FALSE );
change_internal();
......
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