]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added snapshotDir
authorArvin Schnell <aschnell@suse.de>
Thu, 13 Jan 2011 14:10:02 +0000 (15:10 +0100)
committerArvin Schnell <aschnell@suse.de>
Thu, 13 Jan 2011 14:10:02 +0000 (15:10 +0100)
snapper/Snapper.cc

index dfad274a32f287ecf2877903e05ace56a3313e9e..bafa3f8ff74c6bf926829ea8807eed6c171b0327 100644 (file)
@@ -73,12 +73,22 @@ namespace snapper
     }
 
 
-    bool operator<(Snapshot a, Snapshot b)
+    bool operator<(const Snapshot& a, const Snapshot& b)
     {
        return a.num < b.num;
     }
 
 
+    string
+    snapshotDir(const Snapshot& snapshot)
+    {
+       if (snapshot.num == 0)
+           return "/";
+       else
+           return SNAPSHOTSDIR "/" + decString(snapshot.num) + "/snapshot";
+    }
+
+
     void
     readSnapshots()
     {
@@ -306,13 +316,10 @@ namespace snapper
     void
     compareBtrfsSnapshots()
     {
-       string dir1 = SNAPSHOTSDIR "/" + decString(snapshot1.num) + "/snapshot";
-       string dir2 = SNAPSHOTSDIR "/" + decString(snapshot2.num) + "/snapshot";
-
        files.clear();
        pre_to_post_status.clear();
 
-       cmpDirs(dir1, dir2, log);
+       cmpDirs(snapshotDir(snapshot1), snapshotDir(snapshot2), log);
     }