| 1 | #include "../../includes/linux/InotifyService.h" |
| 2 | |
| 3 | InotifyService::InotifyService(std::shared_ptr<EventQueue> queue, std::string path, const std::vector<std::string> &excludedPaths): |
| 4 | mEventLoop(NULL), |
| 5 | mQueue(queue), |
| 6 | mTree(NULL) { |
| 7 | mInotifyInstance = inotify_init(); |
| 8 | |
| 9 | if (mInotifyInstance == -1) { |
| 10 | return; |
| 11 | } |
| 12 | |
| 13 | mTree = new InotifyTree(mInotifyInstance, path, excludedPaths); |
| 14 | if (!mTree->isRootAlive()) { |
| 15 | delete mTree; |
| 16 | mTree = NULL; |
| 17 | mEventLoop = NULL; |
| 18 | close(mInotifyInstance); |
| 19 | } else { |
| 20 | mEventLoop = new InotifyEventLoop( |
| 21 | mInotifyInstance, |
| 22 | this |
| 23 | ); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | InotifyService::~InotifyService() { |
| 28 | if (mEventLoop != NULL) { |
nothing calls this directly
no test coverage detected