traversedir_modis.pl
1.46 KB
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
#!/usr/bin/perl -w
($#ARGV < 4) && die "Too few ARGUMENTS!\n";
$relDir = $ARGV[0];
$en_file = $ARGV[1];
$dis_file = $ARGV[2];
$if_fil = uc($ARGV[3]);
$log_fil = uc($ARGV[4]);
(!-d $relDir) && die "Release Directory $relDir does NOT exist\n";
(!-e $en_file) && die "Enable file $en_file does NOT exist\n";
(!-e $dis_file) && die "Disable file $dis_file does NOT exist\n";
($if_fil ne "TRUE") && ($if_fil ne "FALSE") && die "if_fil $if_fil should be TRUE/FALSE\n";
($log_fil ne "TRUE") && ($log_fil ne "FALSE") && die "log_fil $log_fil should be TRUE/FALSE\n";
@thedirs = ($relDir);
@allfiles = qw();
foreach $tarDir (@thedirs) {
if (opendir(OBJDIRS, $tarDir)) {
@syndirs = sort readdir(OBJDIRS);
closedir(OBJDIRS);
} else {
warn "Could not open $tarDir\n";
next;
}
foreach $f (@syndirs) {
next if ($f eq ".");
next if ($f eq "..");
next if (($f eq "tools") && ($tarDir eq $relDir));
$fname = $tarDir . "\\". $f;
if (-d $fname) {
push(@thedirs, $fname);
} elsif ($f =~ /\.(c|h|cpp|hpp|s)$/i) {
next if (lc($f) eq "t9.h");
push(@allfiles, $fname);
}
}
}
$tmpFile = "$relDir\\~traverseFile.c";
foreach $f (@allfiles) {
if ($if_fil eq "TRUE") {
print("$f\n");
#print("\tif_fil\n");
system("perl tools\\if_fil.pl $f $en_file $dis_file $tmpFile");
system("move /y $tmpFile $f > nul");
}
if ($log_fil eq "TRUE") {
#print("\tlog_fil\n");
system("perl tools\\log_fil.pl $f > nul");
}
}
exit 0;