chomp($COPYRIGHT_END_YEAR);
}
-my $OUTPUT_DIR = File::Spec->catdir($ARGV[0], 'include');
-my $OUTPUT_FILE = File::Spec->catfile($OUTPUT_DIR, 'autoversion.h');
+# Make sure we don't have any leading or trailing quote
+$ARGV[0] =~ s/^\"//;
+$ARGV[0] =~ s/\"$//;
+my $OUTPUT_DIR = File::Spec->catdir(File::Spec->canonpath($ARGV[0]), 'include');
unless (-d $OUTPUT_DIR) {
make_path($OUTPUT_DIR) or die "Couldn't create $OUTPUT_DIR: $!";
}
+my $OUTPUT_FILE = File::Spec->catfile($OUTPUT_DIR, 'autoversion.h');
+
# Take the initial version number from RC_ProjectSourceVersion if it
# exists, otherwise fall back to the version number stored in the source.
my $ENVIRONMENT_VERSION = $ENV{'RC_ProjectSourceVersion'};
my $BUILD_MINOR_VERSION = $2;
my $BUILD_TINY_VERSION = $3;
+# The default version (with no decimals) will be matched by the regexp
+# to $BUILD_TINY_VERSION. If that happens, we need to move it to
+# $BUILD_MAJOR_VERSION.
+if (!defined $BUILD_MAJOR_VERSION && !defined $BUILD_MINOR_VERSION) {
+ $BUILD_MAJOR_VERSION = $BUILD_TINY_VERSION;
+ $BUILD_TINY_VERSION = 0;
+}
+
# Cut the major component down to three characters by dropping any
# extra leading digits, then adjust the major version portion of the
# version string to match.