From 2fe2220a4c8446f5212094752657a11f6c7da201 Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Fri, 6 Feb 2015 16:06:02 +0100 Subject: [PATCH] only save if changed. --- usetaglib.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usetaglib.cpp b/usetaglib.cpp index 7909009..43ae55c 100644 --- a/usetaglib.cpp +++ b/usetaglib.cpp @@ -221,6 +221,8 @@ int main(int argc, char *argv[]) if(f.isNull()) continue; + + bool FCHANGED = false; for (actionqueue::iterator actit = requestedActions.begin(); actit != requestedActions.end(); ++actit) { switch (actit->first) { @@ -234,19 +236,23 @@ int main(int argc, char *argv[]) case ERASE: action_eraseTag(f, actit->second); + FCHANGED = true; break; case REPLACE: action_replaceTag(f, splitToTagPair(actit->second)); + FCHANGED = true; break; case INSERT: action_insertTag(f, splitToTagPair(actit->second)); + FCHANGED = true; break; } } - - f.file()->save(); + + if (FCHANGED) + f.file()->save(); } return 0; -- 2.39.5