TrinityCore
|
Go to the source code of this file.
Macros | |
#define | EFSW_API |
Typedefs | |
typedef long | efsw_watchid |
Type for a watch id. More... | |
typedef void * | efsw_watcher |
Type for watcher. More... | |
typedef void(* | efsw_pfn_fileaction_callback )(efsw_watcher watcher, efsw_watchid watchid, const char *dir, const char *filename, enum efsw_action action, const char *old_filename, void *param) |
Basic interface for listening for file events. More... | |
Enumerations | |
enum | efsw_action { EFSW_ADD = 1, EFSW_DELETE = 2, EFSW_MODIFIED = 3, EFSW_MOVED = 4 } |
enum | efsw_error { EFSW_NOTFOUND = -1, EFSW_REPEATED = -2, EFSW_OUTOFSCOPE = -3, EFSW_NOTREADABLE = -4, EFSW_REMOTE = -5, EFSW_UNSPECIFIED = -6 } |
Functions | |
efsw_watcher EFSW_API | efsw_create (int generic_mode) |
void EFSW_API | efsw_release (efsw_watcher watcher) |
Release the file-watcher and unwatch any directories. More... | |
EFSW_API const char * | efsw_getlasterror () |
Retreive last error occured by file-watcher. More... | |
efsw_watchid EFSW_API | efsw_addwatch (efsw_watcher watcher, const char *directory, efsw_pfn_fileaction_callback callback_fn, int recursive, void *param) |
void EFSW_API | efsw_removewatch (efsw_watcher watcher, const char *directory) |
Remove a directory watch. This is a brute force search O(nlogn). More... | |
void EFSW_API | efsw_removewatch_byid (efsw_watcher watcher, efsw_watchid watchid) |
Remove a directory watch. This is a map lookup O(logn). More... | |
void EFSW_API | efsw_watch (efsw_watcher watcher) |
Starts watching ( in other thread ) More... | |
void EFSW_API | efsw_follow_symlinks (efsw_watcher watcher, int enable) |
int EFSW_API | efsw_follow_symlinks_isenabled (efsw_watcher watcher) |
void EFSW_API | efsw_allow_outofscopelinks (efsw_watcher watcher, int allow) |
int EFSW_API | efsw_outofscopelinks_isallowed (efsw_watcher watcher) |
#define EFSW_API |
Copyright (c) 2013 Martin Lucas Golini
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This software is a fork of the "simplefilewatcher" by James Wynn (james) @jam eswyn n.co mhttp://code.google.com/p/simplefilewatcher/ also MIT licensed.This is the C API wrapper of EFSW
typedef void(* efsw_pfn_fileaction_callback)(efsw_watcher watcher, efsw_watchid watchid, const char *dir, const char *filename, enum efsw_action action, const char *old_filename, void *param) |
Basic interface for listening for file events.
typedef void* efsw_watcher |
Type for watcher.
typedef long efsw_watchid |
Type for a watch id.
enum efsw_action |
enum efsw_error |
efsw_watchid EFSW_API efsw_addwatch | ( | efsw_watcher | watcher, |
const char * | directory, | ||
efsw_pfn_fileaction_callback | callback_fn, | ||
int | recursive, | ||
void * | param | ||
) |
Add a directory watch. Same as the other addWatch, but doesn't have recursive option. For backwards compatibility. On error returns WatchID with Error type.
void EFSW_API efsw_allow_outofscopelinks | ( | efsw_watcher | watcher, |
int | allow | ||
) |
When enable this it will allow symlinks to watch recursively out of the pointed directory. follorSymlinks must be enabled to this work. For example, added symlink to /home/folder, and the symlink points to /, this by default is not allowed, it's only allowed to symlink anything from /home/ and deeper. This is to avoid great levels of recursion. Enabling this could lead in infinite recursion, and crash the watcher ( it will try not to avoid this ). Buy enabling out of scope links, it will allow this behavior. allowOutOfScopeLinks are disabled by default.
efsw_watcher EFSW_API efsw_create | ( | int | generic_mode | ) |
Creates a new file-watcher
generic_mode | Force the use of the Generic file watcher |
void EFSW_API efsw_follow_symlinks | ( | efsw_watcher | watcher, |
int | enable | ||
) |
int EFSW_API efsw_follow_symlinks_isenabled | ( | efsw_watcher | watcher | ) |
int EFSW_API efsw_outofscopelinks_isallowed | ( | efsw_watcher | watcher | ) |
void EFSW_API efsw_release | ( | efsw_watcher | watcher | ) |
Release the file-watcher and unwatch any directories.
void EFSW_API efsw_removewatch | ( | efsw_watcher | watcher, |
const char * | directory | ||
) |
void EFSW_API efsw_removewatch_byid | ( | efsw_watcher | watcher, |
efsw_watchid | watchid | ||
) |
void EFSW_API efsw_watch | ( | efsw_watcher | watcher | ) |