blob: 36f0e2f83879bd2fd2c262beebb939cde141c4f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#include "xmlFreeFileSync.h"
#include "../shared/standardPaths.h"
#include "../shared/globalFunctions.h"
#include "../shared/zstring.h"
#include "functions.h"
#include "../shared/xmlBase.h"
//include FreeFileSync xml headers
#include "../library/processXml.h"
#ifdef FFS_WIN
class CmpNoCase
{
public:
bool operator()(const wxString& a, const wxString& b)
{
return FreeFileSync::compareStringsWin32(a.c_str(), b.c_str(), a.length(), b.length()) < 0;
}
};
#endif
void RealtimeSync::readRealOrBatchConfig(const wxString& filename, xmlAccess::XmlRealConfig& config) //throw (xmlAccess::XmlError);
{
if (xmlAccess::getXmlType(filename) != xmlAccess::XML_BATCH_CONFIG)
{
xmlAccess::readRealConfig(filename, config);
return;
}
//convert batch config to RealtimeSync config
xmlAccess::XmlBatchConfig batchCfg;
try
{
xmlAccess::readBatchConfig(filename, batchCfg); //throw (xmlAccess::XmlError);
}
catch (const xmlAccess::XmlError& e)
{
if (e.getSeverity() != xmlAccess::XmlError::WARNING) //ignore parsing errors
throw;
}
#ifdef FFS_WIN
std::set<wxString, CmpNoCase> uniqueFolders;
#elif defined FFS_LINUX
std::set<wxString> uniqueFolders;
#endif
for (std::vector<FreeFileSync::FolderPair>::const_iterator i = batchCfg.directoryPairs.begin(); i != batchCfg.directoryPairs.end(); ++i)
{
uniqueFolders.insert(i->leftDirectory.c_str());
uniqueFolders.insert(i->rightDirectory.c_str());
}
config.directories.insert(config.directories.end(), uniqueFolders.begin(), uniqueFolders.end());
config.commandline = FreeFileSync::getInstallationDir() + globalFunctions::FILE_NAME_SEPARATOR + wxT("FreeFileSync.exe ") +
wxT("\"") + filename + wxT("\"");
}
int RealtimeSync::getProgramLanguage()
{
xmlAccess::XmlGlobalSettings settings;
xmlAccess::readGlobalSettings(settings);
return settings.programLanguage;
}
|