ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.48 by root, Tue Jul 31 02:24:43 2007 UTC vs.
Revision 1.49 by root, Thu Aug 9 22:46:08 2007 UTC

394 394
395 sub load_cached($;$) { 395 sub load_cached($;$) {
396 unless (exists $FILECACHE{$_[0]}) { 396 unless (exists $FILECACHE{$_[0]}) {
397 my $data; 397 my $data;
398 if (0 < aio_load $_[0], $data) { 398 if (0 < aio_load $_[0], $data) {
399 if ($_[1]) {
399 $data = $_[1]->($data) 400 $data = eval { $_[1]->($data) };
400 if $_[1]; 401 warn "$_[0]: $@" if $@;
402 }
401 } 403 }
402 404
403 $FILECACHE{$_[0]} = $data; 405 $FILECACHE{$_[0]} = $data;
404 } 406 }
405 407
412 414
413 my $data; 415 my $data;
414 aio_load "$dir/$file", $data; 416 aio_load "$dir/$file", $data;
415 417
416 my $meta = load_cached "$dir/meta", sub { JSON::XS::from_json shift }; 418 my $meta = load_cached "$dir/meta", sub { JSON::XS::from_json shift };
419
420 return if $meta && !exists $meta->{$file};
417 421
418 $meta = { 422 $meta = {
419 %{ $meta->{"" } || {} }, 423 %{ $meta->{"" } || {} },
420 %{ $meta->{$file} || {} }, 424 %{ $meta->{$file} || {} },
421 }; 425 };
426
427 if ($meta->{license} =~ s/^#//) {
428 $meta->{license} = ({
429 "pd" => "Public Domain",
430 "gpl" => "GNU General Public License, version 3.0 or any later",
431 "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/",
432 "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.5/",
433 "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/",
434 })->{$meta->{license}}
435 || warn "$dir/$file: license tag '$meta->{license}' not found.";
436 }
422 437
423 $file =~ s/\.res$//; 438 $file =~ s/\.res$//;
424 $file =~ s/\.(ogg|wav|jpg|png)$//; 439 $file =~ s/\.(ogg|wav|jpg|png)$//;
425 440
426 substr $dir, 0, 1 + length $PATH, ""; 441 substr $dir, 0, 1 + length $PATH, "";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines