Migrate FileWatcher to EFSW
This commit is contained in:
@@ -5,14 +5,27 @@
|
||||
#undef RemoveDirectory
|
||||
#endif
|
||||
|
||||
#include <system/Mutex.h>
|
||||
#include <hx/CFFI.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
struct FileWatcherEvent {
|
||||
|
||||
long watchID;
|
||||
std::string dir;
|
||||
std::string file;
|
||||
int action;
|
||||
std::string oldFile;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class FileWatcher {
|
||||
|
||||
|
||||
@@ -21,16 +34,19 @@ namespace lime {
|
||||
FileWatcher (value callback);
|
||||
~FileWatcher ();
|
||||
|
||||
unsigned long AddDirectory (const std::string directory, bool recursive);
|
||||
void RemoveDirectory (unsigned long watchID);
|
||||
long AddDirectory (const std::string directory, bool recursive);
|
||||
void QueueEvent (FileWatcherEvent event);
|
||||
void RemoveDirectory (long watchID);
|
||||
void Update ();
|
||||
|
||||
AutoGCRoot* callback;
|
||||
|
||||
private:
|
||||
|
||||
AutoGCRoot* callback;
|
||||
void* fileWatcher = 0;
|
||||
std::map<unsigned long, void*> watchListeners;
|
||||
Mutex* mutex;
|
||||
std::vector<FileWatcherEvent> queue;
|
||||
std::map<long, void*> listeners;
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user