From 0b4644099d860d3ffa10a422dbcab59f44a069b8 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 21 Jan 2005 14:26:03 +0000 Subject: - rename Xconfig::main::is_valid() to Xconfig::main::check_valid() and return the cause of the error - ensure an empty config file doesn't make it display "Your Xorg configuration file is broken..." --- perl-install/Xconfig/main.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'perl-install/Xconfig') diff --git a/perl-install/Xconfig/main.pm b/perl-install/Xconfig/main.pm index e53ce0caa..f3fa7047b 100644 --- a/perl-install/Xconfig/main.pm +++ b/perl-install/Xconfig/main.pm @@ -158,10 +158,12 @@ sub configure_chooser { sub configure_everything_or_configure_chooser { my ($in, $options, $auto, $o_keyboard, $o_mouse) = @_; - my $raw_X = eval { Xconfig::xfree->read }; - if (!$raw_X || !is_valid($raw_X)) { - log::l("ERROR: bad X config file $@"); + my $raw_X = eval { Xconfig::xfree->read }; + my $err = $@ && formatError($@); + $err ||= check_valid($raw_X) if $raw_X && @$raw_X; #- that's ok if config is empty + if ($err) { + log::l("ERROR: bad X config file (error: $err)"); $in->ask_okcancel('', N("Your Xorg configuration file is broken, we will ignore it.")) or return; $raw_X = []; @@ -215,15 +217,15 @@ sub export_to_install_X { $::o->{X}{Xinerama} = 1 if $X->{card}{Xinerama}; } -sub is_valid { +sub check_valid { my ($raw_X) = @_; my %sections = map { - my @l = $raw_X->get_Sections($_) or return; + my @l = $raw_X->get_Sections($_) or return "missing section $_"; $_ => \@l; } qw(Files InputDevice Monitor Device Screen ServerLayout); - $sections{Files}[0]{FontPath}; + $sections{Files}[0]{FontPath} or return "missing FontPath"; } #- most usefull XFree86-4.0.1 server options. Default values is the first ones. -- cgit v1.2.1