summaryrefslogtreecommitdiff
path: root/vs_postclean.pl
diff options
context:
space:
mode:
authorAdam Mitz <mitza-oci@users.noreply.github.com>2008-07-11 15:19:35 +0000
committerAdam Mitz <mitza-oci@users.noreply.github.com>2008-07-11 15:19:35 +0000
commit4fe2cd2581553250be14ca3da80ddf046feb78a9 (patch)
tree1b15c22c42134286b4a085d76d39e946ef60e7cb /vs_postclean.pl
parentb62be7b8498567b01449da9e6faa06ab16c82e05 (diff)
downloadMPC-4fe2cd2581553250be14ca3da80ddf046feb78a9.tar.gz
ChangeLogTag: Fri Jul 11 15:18:27 UTC 2008 Adam Mitz <mitza@ociweb.com>
Diffstat (limited to 'vs_postclean.pl')
-rwxr-xr-xvs_postclean.pl30
1 files changed, 28 insertions, 2 deletions
diff --git a/vs_postclean.pl b/vs_postclean.pl
index c8923938..01d7a111 100755
--- a/vs_postclean.pl
+++ b/vs_postclean.pl
@@ -17,6 +17,7 @@ eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
use strict;
use FileHandle;
use File::Basename;
+use Cwd;
# ******************************************************************
# Data Section
@@ -60,6 +61,11 @@ sub read_proj {
close($fh);
}
+ $cmd =~ s/&amp;/&/g;
+ $cmd =~ s/&quot;/\'/g;
+ $cmd =~ s/&gt;/>/g;
+ $cmd =~ s/&lt;/</g;
+
## Return the command line (undef if there was no postclean)
return $cmd;
}
@@ -72,8 +78,10 @@ sub clean_proj {
## Move to the directory of the project and run the command
if (defined $cmd) {
+ my $current_dir = getcwd();
if (chdir(dirname($file))) {
system($cmd);
+ chdir($current_dir);
}
else {
print "WARNING: Unable to postclean $file\n";
@@ -81,13 +89,27 @@ sub clean_proj {
}
}
+sub clean_sln {
+ my($cfg, $file) = @_;
+ my $fh = new FileHandle();
+
+ if (open($fh, $file)) {
+ while (<$fh>) {
+ if (/^Project\([^)]+\) = "[^\"]+", "([^\"]+)"/) {
+ clean_proj($cfg, $1);
+ }
+ }
+ close($fh);
+ }
+}
+
# ******************************************************************
# Main Section
# ******************************************************************
if ($#ARGV == -1) {
print "PostClean v$version\n",
- "Usage: ", basename($0), " [CFG=<configuration>] <project files>\n";
+ "Usage: ", basename($0), " [CFG=<configuration>] <project or solution files>\n";
exit(0);
}
@@ -98,5 +120,9 @@ if ($ARGV[0] =~ /^CFG=(.+)/) {
}
foreach my $file (@ARGV) {
- clean_proj($cfg, $file);
+ if (substr($file, -4, 4) eq '.sln') {
+ clean_sln($cfg, $file);
+ } else {
+ clean_proj($cfg, $file);
+ }
}