diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-04-09 17:40:13 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-04-09 17:40:13 +0800 |
| commit | 9750786a5c03b5ce3ea22b240d1b3cd34990856b (patch) | |
| tree | e495e43245e1bacc86d33142af202613a82a40c1 /src/3rdParty/efsw/FileWatcherImpl.cpp | |
| parent | 571fb952b99e580a0381f539885f8f175e2ec3b0 (diff) | |
| download | yuescript-9750786a5c03b5ce3ea22b240d1b3cd34990856b.tar.gz yuescript-9750786a5c03b5ce3ea22b240d1b3cd34990856b.tar.bz2 yuescript-9750786a5c03b5ce3ea22b240d1b3cd34990856b.zip | |
Updated efsw. Fixed issue #204.
Diffstat (limited to 'src/3rdParty/efsw/FileWatcherImpl.cpp')
| -rw-r--r--[-rwxr-xr-x] | src/3rdParty/efsw/FileWatcherImpl.cpp | 57 |
1 files changed, 34 insertions, 23 deletions
diff --git a/src/3rdParty/efsw/FileWatcherImpl.cpp b/src/3rdParty/efsw/FileWatcherImpl.cpp index f6b86a5..bf69a45 100755..100644 --- a/src/3rdParty/efsw/FileWatcherImpl.cpp +++ b/src/3rdParty/efsw/FileWatcherImpl.cpp | |||
| @@ -1,23 +1,34 @@ | |||
| 1 | #include <efsw/FileWatcherImpl.hpp> | 1 | #include <efsw/FileWatcherImpl.hpp> |
| 2 | #include <efsw/String.hpp> | 2 | #include <efsw/String.hpp> |
| 3 | #include <efsw/System.hpp> | 3 | #include <efsw/System.hpp> |
| 4 | 4 | ||
| 5 | namespace efsw { | 5 | namespace efsw { |
| 6 | 6 | ||
| 7 | FileWatcherImpl::FileWatcherImpl( FileWatcher* parent ) : | 7 | FileWatcherImpl::FileWatcherImpl( FileWatcher* parent ) : |
| 8 | mFileWatcher( parent ), mInitOK( false ), mIsGeneric( false ) { | 8 | mFileWatcher( parent ), mInitOK( false ), mIsGeneric( false ) { |
| 9 | System::maxFD(); | 9 | System::maxFD(); |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | FileWatcherImpl::~FileWatcherImpl() {} | 12 | FileWatcherImpl::~FileWatcherImpl() {} |
| 13 | 13 | ||
| 14 | bool FileWatcherImpl::initOK() { | 14 | bool FileWatcherImpl::initOK() { |
| 15 | return static_cast<bool>( mInitOK ); | 15 | return static_cast<bool>( mInitOK ); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | bool FileWatcherImpl::linkAllowed( const std::string& curPath, const std::string& link ) { | 18 | bool FileWatcherImpl::linkAllowed( const std::string& curPath, const std::string& link ) { |
| 19 | return ( mFileWatcher->followSymlinks() && mFileWatcher->allowOutOfScopeLinks() ) || | 19 | return ( mFileWatcher->followSymlinks() && mFileWatcher->allowOutOfScopeLinks() ) || |
| 20 | -1 != String::strStartsWith( curPath, link ); | 20 | -1 != String::strStartsWith( curPath, link ); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | } // namespace efsw | 23 | int FileWatcherImpl::getOptionValue( const std::vector<WatcherOption>& options, Option option, |
| 24 | int defaultValue ) { | ||
| 25 | for ( size_t i = 0; i < options.size(); i++ ) { | ||
| 26 | if ( options[i].mOption == option ) { | ||
| 27 | return options[i].mValue; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | return defaultValue; | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace efsw | ||
