ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/bin/cfarch-normalize
Revision: 1.1
Committed: Thu Aug 31 21:09:33 2006 UTC (17 years, 9 months ago) by elmex
Branch: MAIN
CVS Tags: rel-0_92, rel-0_91, rel-0_96, rel-0_9
Log Message:
loading and saving of arches and a better documentation in types.xml for safe ground

File Contents

# Content
1 #!/opt/bin/perl
2
3 use Crossfire;
4
5 load_archetypes;
6
7 for my $path (@ARGV) {
8 eval {
9 open my $fh, "<:raw:perlio:utf8", $path
10 or die "$path: $!\n";
11
12 <$fh> =~ /^Object/i
13 or die "$path: not a crossfire arch file\n";
14
15 my $arch = read_arch ($path);
16
17
18
19 open my $fh2, ">:raw:utf8", "$path~" or Carp::croak "$path~: $!";
20 print $fh2 Crossfire::archlist_to_string ([values %$arch])
21 or Carp::croak "$path~: $!";
22 close $fh2 or Carp::croak "$path~: $!";
23 rename "$path~", $path;
24
25 1
26 } or warn $@;
27 }
28