needsWriting in juce_PropertiesFile


#1

I don’t think juce_PropertiesFile::save is updating needsWriting properly when handling XML files. This diff fixes it for me.

[code]$ git diff juce_PropertiesFile.cpp
diff --git a/src/utilities/juce_PropertiesFile.cpp b/src/utilities/juce_PropertiesFile.cpp
old mode 100644
new mode 100755
index 5853667…b9db2f5
— a/src/utilities/juce_PropertiesFile.cpp
+++ b/src/utilities/juce_PropertiesFile.cpp
@@ -177,7 +177,11 @@ bool PropertiesFile::save()
e->setAttribute (T(“val”), getAllProperties().getAllValues() [i]);
}

  •    return doc.writeToFile (file, String::empty);
    
  •    if (doc.writeToFile(file, String::empty))
    
  •    {
    
  •        needsWriting = false;
    
  •        return true;
    
  •    }
    
    }
    else
    {[/code]

#2

Yes, you’re quite right about that, thanks! And as you asked in another post, I’ll add a public mutator method for the needsSaving flag…