--- deliantra/Deliantra-Client/DC.pm 2008/01/10 21:53:33 1.171 +++ deliantra/Deliantra-Client/DC.pm 2008/09/02 17:08:44 1.190 @@ -12,18 +12,23 @@ =cut +package Deliantra::Client; # work around CPAN breakage +package App::Deliantra; # try to reserve namespace package DC; use Carp (); +our $VERSION; + BEGIN { - $VERSION = '0.9963'; + $VERSION = '0.9975'; use XSLoader; XSLoader::load "Deliantra::Client", $VERSION; } use utf8; +use strict qw(vars subs); use AnyEvent (); use Pod::POM (); @@ -142,15 +147,23 @@ package DC; +our @RC_THEME = ("theme-blue", "."); +our $RC_BASE; + +for (grep !ref, @INC) { + $RC_BASE = "$_/Deliantra/Client/private/resources"; + last if -d $RC_BASE; +} + sub find_rcfile($) { my $path; - for (grep !ref, @INC) { - $path = "$_/Deliantra/Client/private/resources/$_[0]"; + for (@RC_THEME) { + $path = "$RC_BASE/$_/$_[0]"; return $path if -r $path; } - die "FATAL: can't find required file $_[0]\n"; + die "FATAL: can't find required file \"$_[0]\" in \"$RC_BASE\"\n"; } sub read_cfg { @@ -166,13 +179,13 @@ } sub write_cfg { - my ($file) = @_; + my $file = "$Deliantra::VARDIR/client.cf"; $::CFG->{VERSION} = $::VERSION; open my $fh, ">:utf8", $file or return; - print $fh encode_json $::CFG; + print $fh JSON::XS->new->utf8->pretty->encode ($::CFG); } sub http_proxy { @@ -225,7 +238,6 @@ } else { fcntl $fh, &Fcntl::F_SETFL, $nb ? &Fcntl::O_NONBLOCK : 0; } - } package DC::Layout;