From 62fe75d32f53b37cd90aa1135582bcc56d4aa8a7 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Fri, 16 Mar 2007 23:51:02 +0000 Subject: upgrade.pl now works to upgrade templates git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@917 4979c152-3d1c-0410-bac9-87ea11338e46 --- upgrade.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'upgrade.pl') diff --git a/upgrade.pl b/upgrade.pl index 88ee3674..d6befb4f 100644 --- a/upgrade.pl +++ b/upgrade.pl @@ -1,3 +1,22 @@ #!/usr/bin/perl -`perl -ibak -pe 's|<\%(\.)\%>||g' templates/*` +my $dirpath = $ARGV[1]; +$dirpath ||= 'templates'; + +&process_dir($dirpath); + +sub process_dir { + my $dirpath = shift @_; + opendir DIR, $dirpath || die "can't open dir $dirpath for reading:$!"; + my @entries = readdir DIR; + closedir DIR; + for $entry(@entries){ + my $path = "$dirpath/$entry"; + if (-d $path && $entry !~ /^\./){ + &process_dir($path); + } elsif ($entry !~ /^\./){ + print "Processing path $path\n"; + `perl -ibak -pe 's|\<\%(.*)\%\>||g' $path` + } + } +} -- cgit v1.2.3