From: Arvin Schnell Date: Fri, 4 Feb 2011 10:04:00 +0000 (+0100) Subject: - fixed comparing with current system X-Git-Tag: v0.1.3~517 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=316cbc9f48f28fcce5b17b133d8e2b19b77cc02b;p=thirdparty%2Fsnapper.git - fixed comparing with current system --- diff --git a/snapper/File.cc b/snapper/File.cc index 1e979184..84740541 100644 --- a/snapper/File.cc +++ b/snapper/File.cc @@ -78,6 +78,8 @@ namespace snapper { y2mil("num1:" << getSnapshot1()->getNum() << " num2:" << getSnapshot2()->getNum()); + assert(!getSnapshot1()->isCurrent() && !getSnapshot2()->isCurrent()); + entries.clear(); string input = getSnapshot2()->baseDir() + "/filelist-" + @@ -118,6 +120,8 @@ namespace snapper { y2mil("num1:" << getSnapshot1()->getNum() << " num2:" << getSnapshot2()->getNum()); + assert(!getSnapshot1()->isCurrent() && !getSnapshot2()->isCurrent()); + string output = getSnapshot2()->baseDir() + "/filelist-" + decString(getSnapshot1()->getNum()) + ".txt"; @@ -157,10 +161,17 @@ namespace snapper if (initialized) return; - if (!load()) + if (getSnapshot1()->isCurrent() || getSnapshot2()->isCurrent()) { create(); - save(); + } + else + { + if (!load()) + { + create(); + save(); + } } initialized = true; diff --git a/snapper/Snapshot.h b/snapper/Snapshot.h index 9891acb3..b3943d82 100644 --- a/snapper/Snapshot.h +++ b/snapper/Snapshot.h @@ -48,6 +48,7 @@ namespace snapper SnapshotType getType() const { return type; } unsigned int getNum() const { return num; } + bool isCurrent() const { return num == 0; } string getDate() const { return date; }