--- deliantra/Deliantra-Client/DC.pm 2008/05/05 20:22:03 1.179 +++ deliantra/Deliantra-Client/DC.pm 2008/09/02 16:25:27 1.187 @@ -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.9971'; + $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,24 @@ package DC; +our $RC_THEME = "."; +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]"; - return $path if -r $path; - } + $path = "$RC_BASE/$RC_THEME/$_[0]"; + return $path if -r $path; + + $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 { @@ -172,7 +186,7 @@ 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 +239,6 @@ } else { fcntl $fh, &Fcntl::F_SETFL, $nb ? &Fcntl::O_NONBLOCK : 0; } - } package DC::Layout;