From 9750786a5c03b5ce3ea22b240d1b3cd34990856b Mon Sep 17 00:00:00 2001 From: Li Jin Date: Wed, 9 Apr 2025 17:40:13 +0800 Subject: Updated efsw. Fixed issue #204. --- src/3rdParty/efsw/FileWatcherImpl.cpp | 57 +++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 23 deletions(-) mode change 100755 => 100644 src/3rdParty/efsw/FileWatcherImpl.cpp (limited to 'src/3rdParty/efsw/FileWatcherImpl.cpp') diff --git a/src/3rdParty/efsw/FileWatcherImpl.cpp b/src/3rdParty/efsw/FileWatcherImpl.cpp old mode 100755 new mode 100644 index f6b86a5..bf69a45 --- a/src/3rdParty/efsw/FileWatcherImpl.cpp +++ b/src/3rdParty/efsw/FileWatcherImpl.cpp @@ -1,23 +1,34 @@ -#include -#include -#include - -namespace efsw { - -FileWatcherImpl::FileWatcherImpl( FileWatcher* parent ) : - mFileWatcher( parent ), mInitOK( false ), mIsGeneric( false ) { - System::maxFD(); -} - -FileWatcherImpl::~FileWatcherImpl() {} - -bool FileWatcherImpl::initOK() { - return static_cast( mInitOK ); -} - -bool FileWatcherImpl::linkAllowed( const std::string& curPath, const std::string& link ) { - return ( mFileWatcher->followSymlinks() && mFileWatcher->allowOutOfScopeLinks() ) || - -1 != String::strStartsWith( curPath, link ); -} - -} // namespace efsw +#include +#include +#include + +namespace efsw { + +FileWatcherImpl::FileWatcherImpl( FileWatcher* parent ) : + mFileWatcher( parent ), mInitOK( false ), mIsGeneric( false ) { + System::maxFD(); +} + +FileWatcherImpl::~FileWatcherImpl() {} + +bool FileWatcherImpl::initOK() { + return static_cast( mInitOK ); +} + +bool FileWatcherImpl::linkAllowed( const std::string& curPath, const std::string& link ) { + return ( mFileWatcher->followSymlinks() && mFileWatcher->allowOutOfScopeLinks() ) || + -1 != String::strStartsWith( curPath, link ); +} + +int FileWatcherImpl::getOptionValue( const std::vector& options, Option option, + int defaultValue ) { + for ( size_t i = 0; i < options.size(); i++ ) { + if ( options[i].mOption == option ) { + return options[i].mValue; + } + } + + return defaultValue; +} + +} // namespace efsw -- cgit v1.2.3-55-g6feb