UEFMFileWatcher
Monitors a single file for changes. When the file is modified, the OnFileChanged delegate fires with the file path and change type.
Delegate
FOnFileChanged
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnFileChanged, const FString&, FilePath, int32, ChangeType)
| Parameter | Type | Description |
|---|---|---|
FilePath | FString | Path to the changed file |
ChangeType | int32 | Type of change (see below) |
Change Types
| Value | Meaning |
|---|---|
0 | Unknown |
1 | Added |
2 | Modified |
3 | Removed |
Functions
StartWatching
Callable Starts watching a file.
C++
bool StartWatching(const FString& FilePath)
| Parameter | Type | Description |
|---|---|---|
FilePath | FString | Full path to the file to watch |
Returns: true if watching started successfully
Category: EFM|File Watcher
Blueprint Node
ƒStart Watching
File Path
Return Value
StopWatching
Callable Stops watching.
C++
void StopWatching()
Category: EFM|File Watcher
Blueprint Node
ƒStop Watching
IsWatching
Pure Checks if currently watching.
C++
bool IsWatching() const
Category: EFM|File Watcher
Blueprint Node
ƒIs Watching
Return Value
GetWatchedFilePath
Pure Gets the path of the watched file.
C++
FString GetWatchedFilePath() const
Category: EFM|File Watcher
Blueprint Node
ƒGet Watched File Path
Return Value
Properties
OnFileChanged
Assignable Event fired when the watched file changes.
UPROPERTY(BlueprintAssignable)
FOnFileChanged OnFileChanged
Example
// Create watcher
Watcher = Create UEFMFileWatcher
// Bind event
Watcher.OnFileChanged = OnFileChangedEvent
// Start watching
Watcher.StartWatching(GetGameSavedDirectory() + "config.ini")
// OnFileChangedEvent(FilePath, ChangeType):
// if ChangeType == 2: // Modified
// ReloadConfig(FilePath)
// Log("Config reloaded: " + FilePath)
// Later, stop watching
Watcher.StopWatching()