UEFMDirectoryWatcher
Monitors an entire directory for changes. Reports added, modified, and removed files.
Delegate
FOnDirectoryChanged
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnDirectoryChanged, const TArray<FString>&, Added, const TArray<FString>&, Modified, const TArray<FString>&, Removed)
| Parameter | Type | Description |
|---|---|---|
Added | TArray<FString> | Files that were added |
Modified | TArray<FString> | Files that were modified |
Removed | TArray<FString> | Files that were removed |
Functions
StartWatching
Callable Starts watching a directory.
C++
bool StartWatching(const FString& DirectoryPath)
| Parameter | Type | Description |
|---|---|---|
DirectoryPath | FString | Full path to the directory to watch |
Returns: true if watching started successfully
Category: EFM|Watcher
Blueprint Node
ƒStart Watching
Directory Path
Return Value
StopWatching
Callable Stops watching.
C++
void StopWatching()
Category: EFM|Watcher
Blueprint Node
ƒStop Watching
IsWatching
Pure Checks if currently watching.
C++
bool IsWatching() const
Category: EFM|Watcher
Blueprint Node
ƒIs Watching
Return Value
Properties
OnDirectoryChanged
Assignable Event fired when the watched directory changes.
UPROPERTY(BlueprintAssignable)
FOnDirectoryChanged OnDirectoryChanged
Example
// Create watcher
DirWatcher = Create UEFMDirectoryWatcher
// Bind event
DirWatcher.OnDirectoryChanged = OnDirectoryChangedEvent
// Start watching
DirWatcher.StartWatching(GetGameSavedDirectory() + "Mods/")
// OnDirectoryChangedEvent(Added, Modified, Removed):
// for NewFile in Added:
// Log("New file: " + NewFile)
// LoadMod(NewFile)
//
// for ChangedFile in Modified:
// Log("Modified: " + ChangedFile)
// ReloadMod(ChangedFile)
//
// for DeletedFile in Removed:
// Log("Removed: " + DeletedFile)
// UnloadMod(DeletedFile)
// Stop watching when done
DirWatcher.StopWatching()