xref: /trunk/main/officecfg/util/template.gen (revision fc9fd3f14a55d77b35643a64034752a178b2a5b0)
1: # -*- perl -*-
2eval 'exec perl -wS $0 ${1+"$@"}'
3    if 0;
4
5open(OUTFILE, ">$ARGV[1]");
6
7print OUTFILE "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
8print OUTFILE "<org.openoffice.Templates>\n";
9
10
11chdir($ARGV[0]) or die "can't chdir() to $ARGV[0]";
12
13opendir(DIR, ".");
14
15@files=readdir(DIR);
16
17foreach $file (@files) {
18    if ( $file =~ /\w*\.tpl/ ) {
19        open(INFILE, "<$file") or die "can't open file $file";
20        while(<INFILE>) {
21            if ( /xml version=/ ) {
22                next;
23            }
24            print OUTFILE;
25        }
26        close(INFILE);
27    }
28}
29
30print OUTFILE "</org.openoffice.Templates>\n";
31
32closedir(DIR);
33
34close(OUTFILE);
35