40 my @lines = <FILE>; |
40 my @lines = <FILE>; |
41 close FILE; |
41 close FILE; |
42 |
42 |
43 my $updated = 0; |
43 my $updated = 0; |
44 my @newlines = (); |
44 my @newlines = (); |
|
45 my $index = 1; |
45 while (my $line = shift @lines) |
46 while (my $line = shift @lines) |
46 { |
47 { |
47 if (index($line,$newtext[0]) >= 0) |
48 if (index($line,$newtext[0]) >= 0) |
48 { |
49 { |
49 # file already converted - nothing to do |
50 # file already converted - nothing to do |
50 last; |
51 push @newlines, $line; |
51 } |
52 next; |
|
53 #last; |
|
54 } |
52 # under the terms of the License "Symbian Foundation License v1.0" |
55 # under the terms of the License "Symbian Foundation License v1.0" |
53 # which accompanies this distribution, and is available |
56 # which accompanies this distribution, and is available |
54 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
57 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
55 my $pos1 = index $line, $oldtext[0]; |
58 my $pos1 = index $line, $oldtext[0]; |
56 if ($pos1 >= 0) |
59 if ($pos1 >= 0) |
57 { |
60 { |
58 my $midline = shift @lines; |
61 my $midline = shift @lines; |
59 my $urlline = shift @lines; |
62 my $urlline = shift @lines; |
|
63 $index+=2; |
60 my $pos2 = index $urlline, $oldtext[1]; |
64 my $pos2 = index $urlline, $oldtext[1]; |
61 if ($pos2 >= 0) |
65 if ($pos2 >= 0) |
62 { |
66 { |
63 # Found it - assume that there's only one instance |
67 # Found it - assume that there's only one instance |
64 substr $line, $pos1, length($oldtext[0]), $newtext[0]; |
68 substr $line, $pos1, length($oldtext[0]), $newtext[0]; |
65 substr $urlline, $pos2, length($oldtext[1]), $newtext[1]; |
69 substr $urlline, $pos2, length($oldtext[1]), $newtext[1]; |
66 push @newlines, $line, $midline, $urlline; |
70 push @newlines, $line, $midline, $urlline; |
67 $updated = 1; |
71 $updated = 1; |
68 last; |
72 next; |
|
73 #last; |
69 } |
74 } |
70 else |
75 else |
71 { |
76 { |
72 print STDERR "Problem in $file: incorrectly formatted >\n$line$midline$urlline\n"; |
77 if(!$updated) |
73 push @errorfiles, $file; |
78 { |
|
79 print STDERR "Problem in $file at $index: incorrectly formatted >\n$line$midline$urlline\n"; |
|
80 push @errorfiles, $file; |
|
81 } |
74 last; |
82 last; |
75 } |
83 } |
76 } |
84 } |
77 push @newlines, $line; |
85 push @newlines, $line; |
|
86 $index+=1; |
78 } |
87 } |
79 |
88 |
80 return if (!$updated); |
89 return if (!$updated); |
81 |
90 |
82 mkpath($shadowdir, {verbose=>0}); |
91 mkpath($shadowdir, {verbose=>0}); |