Permalink
Browse files

Better build number detection

  • Loading branch information...
1 parent bb05126 commit eddc268deb412e59c91f8baf4fdc89219baad89b @ayende ayende committed Mar 22, 2013
Showing with 10 additions and 2 deletions.
  1. +9 −1 Raven.Database/DocumentDatabase.cs
  2. +1 −1 Raven.Studio/Models/ApplicationModel.cs
@@ -1866,10 +1866,18 @@ public static string BuildVersion
get
{
return buildVersion ??
- (buildVersion = FileVersionInfo.GetVersionInfo(typeof(DocumentDatabase).Assembly.Location).FileBuildPart.ToString(CultureInfo.InvariantCulture));
+ (buildVersion = GetBuildVersion().ToString(CultureInfo.InvariantCulture));
}
}
+ private static int GetBuildVersion()
+ {
+ var fileVersionInfo = FileVersionInfo.GetVersionInfo(typeof (DocumentDatabase).Assembly.Location);
+ if (fileVersionInfo.FilePrivatePart != 0)
+ return fileVersionInfo.FilePrivatePart;
+ return fileVersionInfo.FileBuildPart;
+ }
+
private volatile bool disposed;
private readonly ValidateLicense validateLicense;
public string ServerUrl
@@ -185,7 +185,7 @@ public string AssemblyVersion
{
var version = GetAssemblyVersion();
- return version.Split('.')[2];
+ return version.Split('.').LastOrDefault(x=>x != "0");
}
}
public static List<IDatabaseChanges> ChangesToDispose { get; private set; }

0 comments on commit eddc268

Please sign in to comment.