#!/usr/bin/perl -w
use strict;
use Win32::File::VersionInfo;
$|=1;
my $file = shift @ARGV or die "Syntax: $0 <exe> <version>";
my $version = shift @ARGV or die "Syntax: $0 <exe> <version>";

$file = cygwin2win($file);
print "Verifying version... ";
my $vi = GetFileVersionInfo ( $file ) or die "Failed to get version info for $file";


my $exever = $vi->{FileVersion};
if ( $exever ne $version ) {
	die "Version doesn't match!\nSource code: $version\nInstalled: $exever" 
}

print "ok.\n";



sub cygwin2win {
	my $name = shift;
	$name =~ s/^\/cygdrive\/(\w)\//$1:\\/;
	$name =~ s/\//\\/g;

	return $name;
}
