summaryrefslogtreecommitdiff
path: root/vpc_scripts/generateSnapshot.pl
blob: 4022b084dbd3b04af402866f2d701b4bf99ccc95 (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use strict;
use File::Path;

print( "\nDeleting old backup\n" );
system( "rmdir \/s \/q backup" );

print( "\nMoving previous snapshot to backup\n" );
system( "ren snapshot backup" );

print( "\nSearching for .vcproj files...\n" );

# Find all vcproj's in src
system( "dir \/s U:\\main\\src\\*.vcproj \> vcproj.txt" );

# Read in the source file

open(INFILE, "vcproj.txt" );
my @lines = <INFILE>;
close( INFILE );

# Process the file one line at a time

my @output;

# print the header lines
push( @output, "\/\/ VGC file\n" );
push( @output, "\n" );
push( @output, "\/\/\n" );
push( @output, "\/\/ Project definitions\n" );
push( @output, "\/\/\n" );
push( @output, "\n" );

for( my($i) = 0; $i < @lines; ++$i )
{
	# Grab the path
	if ( $lines[$i] =~ /Directory of U:\\main\\src\\(.*)/ )
	{
		my($path) = $1;
		++$i;

		# ignore projects in vpc_scripts!
		if ( $path =~ /vpc_scripts/ )
		{
			next;
		}

		# Grab the .vcproj filenames
		while ( $lines[++$i] =~ /[\d+\/]{2}\d+\s+\S+\s+\w{2}\s+\S+\s+(\w+).vcproj/ )
		{
			if ( $1 =~ /_x360/ )
			{
				next;
			}
			my($projectName) = $1;

			my($fullpath) = join('\\', "snapshot", $path );
			mkpath ($fullpath);

			my($fullname) = join('\\', $fullpath, $projectName );

			print "\nProcessing $projectName\n\n";

			# generate the vpc
			system ( "generateVPC2005.pl ..\\$path\\$projectName -o $fullpath" );

			# copy the .vcproj into the script tree
			system ( "copy /y ..\\$path\\$projectName.vcproj $fullpath" );
		}
	}
}