diff --git a/Source/Engine/Platform/Base/FileSystemWatcherBase.h b/Source/Engine/Platform/Base/FileSystemWatcherBase.h index 395f0a340..6bfb38baf 100644 --- a/Source/Engine/Platform/Base/FileSystemWatcherBase.h +++ b/Source/Engine/Platform/Base/FileSystemWatcherBase.h @@ -22,61 +22,34 @@ enum class FileSystemAction /// class FLAXENGINE_API FileSystemWatcherBase : public NonCopyable { -protected: - - bool _isEnabled; - bool _withSubDirs; - String _directory; - public: FileSystemWatcherBase(const String& directory, bool withSubDirs) - : _isEnabled(true) - , _withSubDirs(withSubDirs) - , _directory(directory) + : Directory(directory) + , WithSubDirs(withSubDirs) + , Enabled(true) { } +public: + + /// + /// The watcher directory path. + /// + const String Directory; + + /// + /// The value whenever watcher is tracking changes in subdirectories. + /// + const bool WithSubDirs; + + /// + /// The current watcher enable state. + /// + bool Enabled; + /// /// Action fired when directory or file gets changed. Can be invoked from main or other thread depending on the platform. /// Delegate OnEvent; - -public: - - /// - /// Gets the watcher directory string. - /// - /// The target directory path. - const String& GetDirectory() const - { - return _directory; - } - - /// - /// Gets the value whenever watcher is tracking changes in subdirectories. - /// - /// True if watcher is tracking changes in subdirectories, otherwise false. - bool WithSubDirs() const - { - return _withSubDirs; - } - - /// - /// Gets the current watcher enable state. - /// - /// True if watcher is enabled, otherwise false. - bool GetEnabled() const - { - return _isEnabled; - } - - /// - /// Sets the current enable state. - /// - /// A state to assign. - void SetEnabled(bool value) - { - _isEnabled = value; - } }; diff --git a/Source/Engine/Platform/Windows/WindowsFileSystemWatcher.cpp b/Source/Engine/Platform/Windows/WindowsFileSystemWatcher.cpp index 832fd9bb2..466ace2f6 100644 --- a/Source/Engine/Platform/Windows/WindowsFileSystemWatcher.cpp +++ b/Source/Engine/Platform/Windows/WindowsFileSystemWatcher.cpp @@ -87,7 +87,7 @@ VOID CALLBACK NotificationCompletion(DWORD dwErrorCode, DWORD dwNumberOfBytesTra { // Build path String path(notify->FileName, notify->FileNameLength / sizeof(WCHAR)); - path = watcher->GetDirectory() / path; + path = watcher->Directory / path; // Send event watcher->OnEvent(path, action); @@ -106,7 +106,7 @@ BOOL RefreshWatch(WindowsFileSystemWatcher* watcher) watcher->DirectoryHandle, watcher->Buffer[watcher->CurrentBuffer], FileSystemWatcher::BufferSize, - watcher->WithSubDirs() ? TRUE : FALSE, + watcher->WithSubDirs ? TRUE : FALSE, FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_FILE_NAME, &dwBytesReturned, (OVERLAPPED*)&watcher->Overlapped,