forked from mbaltaks/doublecommand
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_strings_versions.pl
executable file
·63 lines (48 loc) · 992 Bytes
/
update_strings_versions.pl
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl
use strict;
my $numargs = @ARGV;
if ( @ARGV < 1 ) {
die "Usage: $0 version-file-path < source > dest\n";
}
my $VersionFile = shift( @ARGV );
my $Version;
#my $inputFile = shift(@ARGV);
if ( @ARGV ) {
die "Usage: $0 version-file-path < source > dest\n";
}
if ( ! open( VERSION, "< $VersionFile" ) ) {
die "Couldn't open $VersionFile for reading: $!\n";
}
while ( <VERSION> ) {
if ( /^#/ ) {
next;
}
chomp;
if ( !length ) {
next;
}
s/^\s*//;
s/\s*$//;
$Version = $_;
last;
}
if ( !defined( $Version ) ) {
die "No version defined in $VersionFile\n";
}
#if ( ! open( in, "< $inputFile" ) ) {
# die "Couldn't open $inputFile for reading: $!\n";
#}
#binmode(in, ":encoding(UTF-16)");
binmode(STDIN, ":encoding(UTF-16)");
binmode(STDOUT, ":encoding(UTF-16)");
while ( <> ) {
if (/version .+,/)
{
s/(version ).+(,.+)/\1$Version\2/g;
}
else
{
s/(VersionString = \").+(\")/\1$Version\2/g;
}
print;
}