From 6c36ef17eef694a2c3b5b144d29a4e51b5102c7c Mon Sep 17 00:00:00 2001 From: wuestholz Date: Mon, 3 Jun 2013 10:21:39 -0700 Subject: Fixed an issue with discovering program snapshots. --- Source/BoogieDriver/BoogieDriver.cs | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'Source/BoogieDriver') diff --git a/Source/BoogieDriver/BoogieDriver.cs b/Source/BoogieDriver/BoogieDriver.cs index a39e8696..be1266b2 100644 --- a/Source/BoogieDriver/BoogieDriver.cs +++ b/Source/BoogieDriver/BoogieDriver.cs @@ -161,16 +161,27 @@ namespace Microsoft.Boogie { if (CommandLineOptions.Clo.VerifySnapshots && lookForSnapshots) { - var snapshots = - from n in fileNames - from f in Directory.GetFiles(Path.GetDirectoryName(Path.GetFullPath(n)), Path.GetFileNameWithoutExtension(n) + ".*" + Path.GetExtension(n)) - select f; - - var snapshotsByVersion = - from n in snapshots - group n by Path.GetFileNameWithoutExtension(n).Substring(Path.GetFileNameWithoutExtension(n).LastIndexOf(".")) into g - orderby g.Key - select g; + var snapshotsByVersion = new List>(); + for (int version = 0; true; version++) + { + var nextSnapshot = new List(); + foreach (var name in fileNames) + { + var versionedName = name.Replace(Path.GetExtension(name), ".v" + version + Path.GetExtension(name)); + if (File.Exists(versionedName)) + { + nextSnapshot.Add(versionedName); + } + } + if (nextSnapshot.Any()) + { + snapshotsByVersion.Add(nextSnapshot); + } + else + { + break; + } + } foreach (var s in snapshotsByVersion) { -- cgit v1.2.3