summaryrefslogtreecommitdiff
path: root/zen/xml_io.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:31:50 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:31:50 +0200
commit570916ddc376b09205125eaaab517561dfead9f0 (patch)
tree309a94f040707c402623e4f9f887346d1b561df7 /zen/xml_io.cpp
parent6.2 (diff)
downloadFreeFileSync-570916ddc376b09205125eaaab517561dfead9f0.tar.gz
FreeFileSync-570916ddc376b09205125eaaab517561dfead9f0.tar.bz2
FreeFileSync-570916ddc376b09205125eaaab517561dfead9f0.zip
6.3
Diffstat (limited to 'zen/xml_io.cpp')
-rw-r--r--zen/xml_io.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/zen/xml_io.cpp b/zen/xml_io.cpp
index 4b9abc29..a8236300 100644
--- a/zen/xml_io.cpp
+++ b/zen/xml_io.cpp
@@ -5,16 +5,16 @@
// **************************************************************************
#include "xml_io.h"
-#include <zen/file_handling.h>
-#include <zen/file_io.h>
-#include <zen/serialize.h>
+#include "file_handling.h"
+#include "file_io.h"
+#include "serialize.h"
using namespace zen;
XmlDoc zen::loadXmlDocument(const Zstring& filename) //throw FileError
{
- //can't simply use zen::loadBinStream() due to the short-circuit xml-validation below!
+ //can't simply use zen::loadBinStream() due to the short-circuit xml-validation below!
std::string stream;
@@ -28,7 +28,7 @@ XmlDoc zen::loadXmlDocument(const Zstring& filename) //throw FileError
stream.resize(bytesRead);
if (!startsWith(stream, xmlBegin) &&
- !startsWith(stream, BYTE_ORDER_MARK_UTF8 + xmlBegin)) //respect BOM!
+ !startsWith(stream, BYTE_ORDER_MARK_UTF8 + xmlBegin)) //allow BOM!
throw FileError(replaceCpy(_("File %x does not contain a valid configuration."), L"%x", fmtFileName(filename)));
}
@@ -62,10 +62,11 @@ void zen::saveXmlDocument(const XmlDoc& doc, const Zstring& filename) //throw Fi
{
std::string stream = serialize(doc); //noexcept
+ //only update xml file if there are real changes
try
{
if (getFilesize(filename) == stream.size()) //throw FileError
- if (loadBinStream<std::string>(filename) == stream) //throw FileError
+ if (loadBinStream<std::string>(filename) == stream) //throw FileError
return;
}
catch (FileError&) {}
bgstack15