-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDCFileWatcher.cpp
More file actions
49 lines (40 loc) · 1.69 KB
/
DCFileWatcher.cpp
File metadata and controls
49 lines (40 loc) · 1.69 KB
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
#include "iostream"
#include "memory"
#include "string"
#include "LogImpl.h"
#include "IniFileUtils.h"
#include "DCReadDirChangesImpl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
const static std::wstring sLogFile = L"DCFileWatcher.log";
int wmain(int argc, wchar_t* argv[])
{
std::wstring sHotPath;
std::wstring sBcpPath;
std::vector<std::pair<std::wstring, std::wstring>> arrToDelete;
ini_file_utils::LoadData(sHotPath, sBcpPath, arrToDelete, sLogFile.c_str());
if (1 == argc) {
CDCOut::OutInfo(sLogFile.c_str(), L"No parameters were passed to the application. Application will start with previuos parameters.");
}
else if (3 == argc) {
sHotPath = argv[1];
sBcpPath = argv[2];
}
else {
CDCOut::OutInfo(sLogFile.c_str(), L"Application supports two parameters: 1) Path to watch; 2) Backup path");
return 0;
}
if (sHotPath.empty() || sBcpPath.empty()) {
CDCOut::OutInfo(sLogFile.c_str(), L"Application supports two parameters: 1) Path to watch; 2) Backup path");
return 0;
}
ini_file_utils::SaveData(sHotPath.c_str(), sBcpPath.c_str(), sLogFile.c_str());
CDCOut::OutInfo(sLogFile.c_str(), L"Application started to watch: ", sHotPath.c_str());
CDCOut::OutInfo(sLogFile.c_str(), L"Application backup path: ", sBcpPath.c_str());
CDCOut::OutInfo(sLogFile.c_str(), L"Application log file: ", sLogFile.c_str());
CDCOut::OutInfo(sLogFile.c_str(), L"Please enter regex, to filter log file.");
std::unique_ptr<CDCReadDirChangesImpl> pWatcher = std::make_unique<CDCReadDirChangesImpl>(sHotPath.c_str(), sBcpPath.c_str(), sLogFile.c_str(), arrToDelete);
pWatcher->Start();
return 0;
}