-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (24 loc) · 675 Bytes
/
main.cpp
File metadata and controls
33 lines (24 loc) · 675 Bytes
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
#include <chrono>
#include <iostream>
#include <string>
#define FILE_WATCHER_IMPLEMENTATION
#include "file_watcher.hpp"
int usage()
{
std::cout << "Usage: FileWatcher.exe [folderPath]" << std::endl;
return 1;
}
int main(int argc, const char* argv[])
{
if (argc != 2) return usage();
const char* folderPath = argv[1];
bool bRecursive = true;
bool bWatching = true;
file_watcher_watch_async(folderPath, bRecursive, file_watcher_print_file_event, &bWatching, nullptr);
std::cout << "Press enter to stop watching" << std::endl;
std::cin.get();
bWatching = false;
std::cout << "Watching stopped, press enter to exit" << std::endl;
std::cin.get();
return 0;
}