diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /devtools/bin/vtfscrewtree.pl | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'devtools/bin/vtfscrewtree.pl')
| -rw-r--r-- | devtools/bin/vtfscrewtree.pl | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/devtools/bin/vtfscrewtree.pl b/devtools/bin/vtfscrewtree.pl new file mode 100644 index 0000000..89d1765 --- /dev/null +++ b/devtools/bin/vtfscrewtree.pl @@ -0,0 +1,83 @@ +sub CreateFile +{ + local( $filename ) = shift; + local( *FILE ); + + open FILE, ">$filename"; + close FILE; +} + +sub ProcessFile +{ + local( $filename ) = shift; + local( @fileContents ); +# print "$filename\n"; + if( $filename =~ /\.vtf/i ) + { + return if( $filename =~ /_normal/i ); + return if( $filename =~ /_dudv/i ); + local( $cmd ) = "..\\..\\..\\bin\\vtfscrew \"$filename\" $r $g $b"; + print $cmd . "\n"; + system $cmd; + } +} + +sub ProcessFileOrDirectory +{ + local( $name ) = shift; + +# If the file has "." at the end, skip it. + if( $name eq "." || $name eq ".." || $name =~ /\.$/ ) + { +# print "skipping: $name\n"; + return; + } + +# Figure out if it's a file or a directory. + if( -d $name ) + { + local( *SRCDIR ); +# print "$name is a directory\n"; + opendir SRCDIR, $name; + local( @dir ) = readdir SRCDIR; + closedir SRCDIR; + + local( $item ); + while( $item = shift @dir ) + { + &ProcessFileOrDirectory( $name . "/" . $item ); + } + } + elsif( -f $name ) + { + &ProcessFile( $name ); + } + else + { + print "$name is neither a file or a directory\n"; + } + return; +} + +$baseDirectory = shift; +$r = shift; +$g = shift; +$b = shift; + +if( !$baseDirectory ) +{ + die "Usage: createvmt.pl baseDir"; +} + +print "baseDirectory = \"$baseDirectory\"\n"; + +opendir SRCDIR, $baseDirectory; +@dir = readdir SRCDIR; +closedir SRCDIR; + +while( $item = shift @dir ) +{ + &ProcessFileOrDirectory( "$baseDirectory/$item" ); +} + + |