--- deliantra/server/utils/cfutil.in 2007/07/31 02:24:43 1.48 +++ deliantra/server/utils/cfutil.in 2007/08/09 22:46:08 1.49 @@ -396,8 +396,10 @@ unless (exists $FILECACHE{$_[0]}) { my $data; if (0 < aio_load $_[0], $data) { - $data = $_[1]->($data) - if $_[1]; + if ($_[1]) { + $data = eval { $_[1]->($data) }; + warn "$_[0]: $@" if $@; + } } $FILECACHE{$_[0]} = $data; @@ -415,11 +417,24 @@ my $meta = load_cached "$dir/meta", sub { JSON::XS::from_json shift }; + return if $meta && !exists $meta->{$file}; + $meta = { %{ $meta->{"" } || {} }, %{ $meta->{$file} || {} }, }; + if ($meta->{license} =~ s/^#//) { + $meta->{license} = ({ + "pd" => "Public Domain", + "gpl" => "GNU General Public License, version 3.0 or any later", + "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/", + "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.5/", + "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/", + })->{$meta->{license}} + || warn "$dir/$file: license tag '$meta->{license}' not found."; + } + $file =~ s/\.res$//; $file =~ s/\.(ogg|wav|jpg|png)$//;