more reliable check for session files, to cover *.ardour.bak cases, and exclude them
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 11 May 2015 22:36:04 +0000 (18:36 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 29 Jun 2015 18:18:12 +0000 (14:18 -0400)
libs/ardour/find_session.cc

index 501927c42c76462fbee86bde87d40090df7dc584..67aa43d071403df44785e9a9869852af16333287 100644 (file)
@@ -117,7 +117,10 @@ find_session (string str, string& path, string& snapshot, bool& isnew)
 
                        suffix = snapshot.find (statefile_suffix);
 
-                       if (suffix == string::npos) {
+                       const string::size_type start_pos_of_extension = snapshot.size () - strlen (statefile_suffix);
+                       // we should check the start of extension position
+                       // because files '*.ardour.bak' are possible
+                       if (suffix != start_pos_of_extension) {
                                error << string_compose (_("%1 is not a snapshot file"), str) << endmsg;
                                return -1;
                        }