-
Notifications
You must be signed in to change notification settings - Fork 71
/
fix_make_paths.pl
44 lines (36 loc) · 1.65 KB
/
fix_make_paths.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
#!/usr/bin/perl --
use strict;
my @files = split(/\n/, `find . -name build.make -print`);
foreach my $file(@files) {
open(my $fh, "< :encoding(UTF-8)", $file) || die "ERROR: Cannot open $file for reading: $!";
my $content = do { local $/; <$fh> };
close($fh) || die "ERROR: Cannot close $file opened for reading: $!";
$content =~ s/\/d //g;
$content =~ s/\\/\//g;
$content =~ s/\/([\r\n])/\\$1/g;
open(my $fh, "> :encoding(UTF-8)", $file) || die "ERROR: Cannot open $file for writing: $!";
print $fh $content;
close($fh) || die "ERROR: Cannot close $file opened for writing: $!";
}
my @files = split(/\n/, `find . -name link.txt -print`);
foreach my $file(@files) {
open(my $fh, "< :encoding(UTF-8)", $file) || die "ERROR: Cannot open $file for reading: $!";
my $content = do { local $/; <$fh> };
close($fh) || die "ERROR: Cannot close $file opened for reading: $!";
$content =~ s/\\/\//g;
$content =~ s/\/([\r\n])/\\$1/g;
open(my $fh, "> :encoding(UTF-8)", $file) || die "ERROR: Cannot open $file for writing: $!";
print $fh $content;
close($fh) || die "ERROR: Cannot close $file opened for writing: $!";
}
my @files = split(/\n/, `find . -name Makefile -print`);
foreach my $file(@files) {
open(my $fh, "< :encoding(UTF-8)", $file) || die "ERROR: Cannot open $file for reading: $!";
my $content = do { local $/; <$fh> };
close($fh) || die "ERROR: Cannot close $file opened for reading: $!";
$content =~ s/\\/\//g;
$content =~ s/\/([\r\n])/\\$1/g;
open(my $fh, "> :encoding(UTF-8)", $file) || die "ERROR: Cannot open $file for writing: $!";
print $fh $content;
close($fh) || die "ERROR: Cannot close $file opened for writing: $!";
}