diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:07 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:07 +0200 |
commit | 88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170 (patch) | |
tree | c6c5babb49b90293380106b81ae5c446959ac70f /zen/file_traverser.h | |
parent | 5.3 (diff) | |
download | FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.gz FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.bz2 FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.zip |
5.4
Diffstat (limited to 'zen/file_traverser.h')
-rw-r--r-- | zen/file_traverser.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/zen/file_traverser.h b/zen/file_traverser.h index ab46621f..c29d987d 100644 --- a/zen/file_traverser.h +++ b/zen/file_traverser.h @@ -17,9 +17,8 @@ namespace zen { -class TraverseCallback +struct TraverseCallback { -public: virtual ~TraverseCallback() {} struct FileInfo @@ -32,21 +31,27 @@ public: struct SymlinkInfo { Int64 lastWriteTimeRaw; //number of seconds since Jan. 1st 1970 UTC - Zstring targetPath; //may be empty if something goes wrong + Zstring targetPath; //optional: empty if something goes wrong bool dirLink; //"true": point to dir; "false": point to file (or broken Link on Linux) }; + enum HandleLink + { + LINK_FOLLOW, //dereferences link, then calls "onDir()" or "onFile()" + LINK_SKIP + }; + enum HandleError { - TRAV_ERROR_RETRY, - TRAV_ERROR_IGNORE + ON_ERROR_RETRY, + ON_ERROR_IGNORE }; //overwrite these virtual methods - virtual std::shared_ptr<TraverseCallback> //nullptr: ignore directory, non-nullptr: traverse into + virtual std::shared_ptr<TraverseCallback> //nullptr: ignore directory, non-nullptr: traverse into using the (new) callback /**/ onDir (const Zchar* shortName, const Zstring& fullName) = 0; virtual void onFile (const Zchar* shortName, const Zstring& fullName, const FileInfo& details) = 0; - virtual void onSymlink(const Zchar* shortName, const Zstring& fullName, const SymlinkInfo& details) = 0; + virtual HandleLink onSymlink(const Zchar* shortName, const Zstring& fullName, const SymlinkInfo& details) = 0; virtual HandleError onError (const std::wstring& errorText) = 0; }; @@ -64,12 +69,8 @@ struct DstHackCallback; //DST hack not required on Linux //custom traverser with detail information about files //directory may end with PATH_SEPARATOR void traverseFolder(const Zstring& directory, //throw(); - bool followSymlinks, TraverseCallback& sink, DstHackCallback* dstCallback = nullptr); //apply DST hack if callback is supplied -//followSymlinks: -//"true": Symlinks dereferenced and reported via onFile() and onDir() => onSymlink not used! -//"false": Symlinks directly reported via onSymlink(), directory symlinks are not followed } #endif // FILETRAVERSER_H_INCLUDED |