Merged in Governor-Tarkin/swg-src (pull request #17)
[swg-src.git] / tools / checkWritableSrc.pl
blobe8a10fce6a68f82afd9d3ec5700d2ec43e70556c
1 #!/usr/bin/perl -w
2 use File::Find;
3 use BuildFunctions;
7 ##
8 # This subroutine finds any non-authorized writable files in a passed directory
10 sub Find_Writable
12 if (-d $_)
14 # found a directory entry
16 # prune the directory if it's one we want to ignore
17 if (m/^(compile)$/)
19 #prune it
20 $File::Find::prune = 1;
23 elsif (-f and -w $_)
24 { if (!m/^.*(aps|ncb|opt|plg)$/)
26 print "n $File::Find::name\n";
27 print Logfile "n $File::Find::name\n";
30 } # End of sub Find_Writable
34 ########## MAIN ##########
36 # Email addresses
37 $gmcdaniel = "gmcdaniel\@soe.sony.com";
41 # Check for any non-authorized writable files in the /swg/current/src directory and email the results
43 $writable_files_log = "WritableFiles.log";
45 print ("Checking for writable files...\n");
46 open (Logfile, ">c:\\buildlogs\\$writable_files_log") || die "Sorry, I couldn't create $writable_files_log";
47 print Logfile "The writable files that were found:\n";
49 # do a find
50 $search_path = "..\\src";
51 @ARGV = ($search_path);
52 find(\&Find_Writable, @ARGV);
54 close (Logfile);
56 $writable_test_time_and_date = get_time_and_date();
57 $date_stamp = get_date();
58 system ("copy c:\\buildlogs\\$writable_files_log c:\\buildlogs\\WritableFiles_$writable_test_time_and_date.log");
59 print ("Checking for writable files completed\n");
60 print ("\n");
61 print ("\n");
62 system ("postie -host:mail-sd.station.sony.com -to:$gmcdaniel -from:$gmcdaniel -s:\"Writable Files Results $date_stamp\" -nomsg -file:c:\\buildlogs\\WritableFiles_$writable_test_time_and_date.log");
65 ## End of Check for any non-authorized writable files in the /swg/current/src directory and email the results
70 ########## END OF MAIN ##########