diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:12:46 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:12:46 +0200 |
commit | b338e29fd3eaf700f8c8360aa0310048ba941d54 (patch) | |
tree | 122f8ef3790d12cd10275ef7453a9e8053322d78 /RealtimeSync/xml_ffs.cpp | |
parent | 3.18 (diff) | |
download | FreeFileSync-b338e29fd3eaf700f8c8360aa0310048ba941d54.tar.gz FreeFileSync-b338e29fd3eaf700f8c8360aa0310048ba941d54.tar.bz2 FreeFileSync-b338e29fd3eaf700f8c8360aa0310048ba941d54.zip |
3.19
Diffstat (limited to 'RealtimeSync/xml_ffs.cpp')
-rw-r--r-- | RealtimeSync/xml_ffs.cpp | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/RealtimeSync/xml_ffs.cpp b/RealtimeSync/xml_ffs.cpp index 15e6f4c2..3424dea2 100644 --- a/RealtimeSync/xml_ffs.cpp +++ b/RealtimeSync/xml_ffs.cpp @@ -18,42 +18,29 @@ using namespace zen; -#ifdef FFS_WIN -struct CmpNoCase -{ - bool operator()(const wxString& a, const wxString& b) const - { - return a.CmpNoCase(b) < 0; - } -}; -#endif - - xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& batchCfg, const wxString& filename) { xmlAccess::XmlRealConfig output; -#ifdef FFS_WIN - std::set<wxString, CmpNoCase> uniqueFolders; -#elif defined FFS_LINUX - std::set<wxString> uniqueFolders; -#endif + std::set<Zstring, LessFilename> uniqueFolders; //add main folders - uniqueFolders.insert(zToWx(batchCfg.mainCfg.firstPair.leftDirectory)); - uniqueFolders.insert(zToWx(batchCfg.mainCfg.firstPair.rightDirectory)); + uniqueFolders.insert(batchCfg.mainCfg.firstPair.leftDirectory); + uniqueFolders.insert(batchCfg.mainCfg.firstPair.rightDirectory); //additional folders - for (std::vector<zen::FolderPairEnh>::const_iterator i = batchCfg.mainCfg.additionalPairs.begin(); - i != batchCfg.mainCfg.additionalPairs.end(); ++i) + std::for_each(batchCfg.mainCfg.additionalPairs.begin(), batchCfg.mainCfg.additionalPairs.end(), + [&](const FolderPairEnh& fp) { - uniqueFolders.insert(zToWx(i->leftDirectory)); - uniqueFolders.insert(zToWx(i->rightDirectory)); - } + uniqueFolders.insert(fp.leftDirectory); + uniqueFolders.insert(fp.rightDirectory); + }); - uniqueFolders.erase(wxString()); + uniqueFolders.erase(Zstring()); - output.directories.insert(output.directories.end(), uniqueFolders.begin(), uniqueFolders.end()); + output.directories.clear(); + std::transform(uniqueFolders.begin(), uniqueFolders.end(), std::back_inserter(output.directories), + [](const Zstring& fn) { return toWx(fn); }); output.commandline = wxT("\"") + zen::getLauncher() + wxT("\"") + wxT(" \"") + filename + wxT("\""); @@ -62,7 +49,7 @@ xmlAccess::XmlRealConfig convertBatchToReal(const xmlAccess::XmlBatchConfig& bat } -void rts::readRealOrBatchConfig(const wxString& filename, xmlAccess::XmlRealConfig& config) //throw (xmlAccess::FfsXmlError); +void rts::readRealOrBatchConfig(const wxString& filename, xmlAccess::XmlRealConfig& config) //throw xmlAccess::FfsXmlError; { if (xmlAccess::getXmlType(filename) != xmlAccess::XML_TYPE_BATCH) { @@ -74,7 +61,7 @@ void rts::readRealOrBatchConfig(const wxString& filename, xmlAccess::XmlRealConf xmlAccess::XmlBatchConfig batchCfg; try { - xmlAccess::readConfig(filename, batchCfg); //throw (xmlAccess::FfsXmlError); + xmlAccess::readConfig(filename, batchCfg); //throw xmlAccess::FfsXmlError; } catch (const xmlAccess::FfsXmlError& e) { |