File: list-pk3.pl

package info (click to toggle)
openarena-data 0.8.5split-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 191,852 kB
  • ctags: 605
  • sloc: ansic: 4,254; makefile: 139; perl: 22
file content (43 lines) | stat: -rw-r--r-- 971 bytes parent folder | download | duplicates (71)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl

use warnings;
use strict;

use Archive::Zip qw();

my $in = shift;

die "usage: ./list-pk3.pl baseoa/pak0.pk3" unless defined $in;

my $zip = Archive::Zip->new($in);

if (! defined $zip) {
	die "unable to open $in";
}

print << "END";
# Produced by list-pk3.pl from $in
# This file is machine-readable, CRC32 \\t filename; to list files,
# use:        sed -n -e 's/#.*//; s/.*\\t//p;'
# To be compatible, you will need the following files and
# checksums (hex) in this order:
END

foreach my $member ($zip->members()) {
	my $crc;
	my $filename = $member->fileName();

	if ($member->isDirectory()) {
		$crc = 'directory';
	}
	else {
		$crc = $member->crc32String();
	}

	print "$crc\t$filename\n";
}

# Copyright 2010 Simon McVittie <smcv@debian.org>
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided this notice is preserved.
# This file is offered as-is, without any warranty.