]> git.treefish.org Git - usetaglib.git/commitdiff
only save if changed.
authorAlexander Schmidt <alex@treefish.org>
Fri, 6 Feb 2015 15:06:02 +0000 (16:06 +0100)
committerAlexander Schmidt <alex@treefish.org>
Fri, 6 Feb 2015 15:06:02 +0000 (16:06 +0100)
usetaglib.cpp

index 7909009ca1895dc40cc37fd408b82129876317ab..43ae55c9349a41d3ee074c52ce2b7647c913d91d 100644 (file)
@@ -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;