Fix bug where fish would refuse to start if $HOME has an invalid value. Thanks to James Vega for the report.

darcs-hash:20070411131823-ac50b-2760c09e8939179a6c771a44220aa355381f4f0b.gz
This commit is contained in:
axel 2007-04-11 23:18:23 +10:00
parent edf896f7cd
commit 5a670e2a96

11
main.c
View file

@ -94,12 +94,20 @@ static int read_init()
context = halloc( 0, 0 ); context = halloc( 0, 0 );
eval_buff = sb_halloc( context ); eval_buff = sb_halloc( context );
config_dir = path_get_config( context ); config_dir = path_get_config( context );
/*
If config_dir is null then we have no configuration directory
and no custom config to load.
*/
if( config_dir )
{
config_dir_escaped = escape( config_dir, 1 ); config_dir_escaped = escape( config_dir, 1 );
sb_printf( eval_buff, L"builtin cd %ls 2>/dev/null; and builtin . config.fish 2>/dev/null", config_dir_escaped ); sb_printf( eval_buff, L"builtin cd %ls 2>/dev/null; and builtin . config.fish 2>/dev/null", config_dir_escaped );
eval( (wchar_t *)eval_buff->buff, 0, TOP ); eval( (wchar_t *)eval_buff->buff, 0, TOP );
free( config_dir_escaped );
}
halloc_free( context ); halloc_free( context );
free( config_dir_escaped );
if( wchdir( cwd ) == -1 ) if( wchdir( cwd ) == -1 )
{ {
@ -301,7 +309,6 @@ int main( int argc, char **argv )
no_exec = 0; no_exec = 0;
} }
proc_init(); proc_init();
event_init(); event_init();
wutil_init(); wutil_init();