summaryrefslogtreecommitdiff
path: root/officecfg/util/template.gen
blob: 5b2c3d40886ae321e17549b6ac9204d5524479e9 (plain)
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
: # -*- perl -*-
eval 'exec perl -wS $0 ${1+"$@"}'
	if 0;

open(OUTFILE, ">$ARGV[1]");

print OUTFILE "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
print OUTFILE "<org.openoffice.Templates>\n";


chdir($ARGV[0]) or die "can't chdir() to $ARGV[0]";

opendir(DIR, ".");

@files=readdir(DIR);

foreach $file (@files) {
	if ( $file =~ /\w*\.tpl/ ) {
		open(INFILE, "<$file") or die "can't open file $file";
		while(<INFILE>) {
			if ( /xml version=/ ) {
				next;
			}	
			print OUTFILE;
		}
		close(INFILE);
	}	
}

print OUTFILE "</org.openoffice.Templates>\n";

closedir(DIR);

close(OUTFILE);