ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.214 by root, Wed Jan 18 00:51:22 2012 UTC vs.
Revision 1.215 by root, Wed Jan 18 13:42:19 2012 UTC

187 187
188 %THEME = ( %$theme, %THEME ); 188 %THEME = ( %$theme, %THEME );
189 } 189 }
190} 190}
191 191
192sub read_cfg { 192sub read_cfg($) {
193 my ($file) = @_; 193 my ($file) = @_;
194 194
195 $::CFG = (load_json $file) || (load_json "$file.bak"); 195 $::CFG = (load_json $file) || (load_json "$file.bak");
196} 196}
197 197
198sub write_cfg { 198sub write_cfg($) {
199 my $file = "$Deliantra::VARDIR/client.cf"; 199 my $file = "$Deliantra::VARDIR/client.cf";
200 200
201 $::CFG->{VERSION} = $::VERSION; 201 $::CFG->{VERSION} = $::VERSION;
202 $::CFG->{layout} = DC::UI::get_layout (); 202 $::CFG->{layout} = DC::UI::get_layout ();
203 203
206 print $fh JSON::XS->new->utf8->pretty->encode ($::CFG); 206 print $fh JSON::XS->new->utf8->pretty->encode ($::CFG);
207 close $fh; 207 close $fh;
208 208
209 rename $file, "$file.bak"; 209 rename $file, "$file.bak";
210 rename "$file~", $file; 210 rename "$file~", $file;
211}
212
213sub load_cfg() {
214 if (-e "$Deliantra::VARDIR/client.cf") {
215 DC::read_cfg "$Deliantra::VARDIR/client.cf";
216 } else {
217 $::CFG = {};
218 }
219}
220
221sub save_cfg() {
222 write_cfg "$Deliantra::VARDIR/client.cf";
211} 223}
212 224
213sub upgrade_cfg() { 225sub upgrade_cfg() {
214 my %DEF_CFG = ( 226 my %DEF_CFG = (
215 config_autosave => 1, 227 config_autosave => 1,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines