--- deliantra/Deliantra-Client/DC.pm 2009/01/04 10:22:19 1.200 +++ deliantra/Deliantra-Client/DC.pm 2009/01/11 03:19:47 1.201 @@ -197,17 +197,22 @@ sub read_cfg { my ($file) = @_; - $::CFG = load_json $file; + $::CFG = (load_json $file) || (load_json "$file.bak"); } sub write_cfg { my $file = "$Deliantra::VARDIR/client.cf"; $::CFG->{VERSION} = $::VERSION; + $::CFG->{layout} = DC::UI::get_layout (); - open my $fh, ">:utf8", $file + open my $fh, ">:utf8", "$file~" or return; print $fh JSON::XS->new->utf8->pretty->encode ($::CFG); + close $fh; + + rename $file, "$file.bak"; + rename "$file~", $file; } sub http_proxy {