Navigation
API > API/Developer > API/Developer/DirectoryWatcher
Class responsible for 'asynchronously' scanning a folder for files and timestamps. Example usage: FAsyncDirectoryReader Reader(TEXT("C:\Path"), EPathType::Relative);
while(!Reader.IsComplete()) { FPlatformProcess::Sleep(1); Reader.Tick(FTimedSignal(1)); // Do 1 second of work } TOptional
| Name | FAsyncDirectoryReader |
| Type | struct |
| Header File | /Engine/Source/Developer/DirectoryWatcher/Public/FileCache.h |
| Include Path | #include "FileCache.h" |
Syntax
struct FAsyncDirectoryReader : public DirectoryWatcher::IAsyncFileCacheTask
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FAsyncDirectoryReader
(
const FString& InDirectory, |
Constructor that sets up the directory reader to the specified directory | FileCache.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bIsComplete | FThreadSafeBool | Thread safe flag to signify when this class has finished reading | FileCache.h | |
| CachedState | TOptional< FDirectoryState > | The previously cached state of the directory, optional | FileCache.h | |
| FilesThatNeedHashing | TArray< FFilenameAndHash > | An array of files that need hashing | FileCache.h | |
| LiveState | TOptional< FDirectoryState > | The currently discovered state of the directory - reset once relinquished to the client through GetLiveState | FileCache.h | |
| PathType | EPathType | Whether we should return relative or absolute paths | FileCache.h | |
| PendingDirectories | TArray< FString > | A list of directories we have recursively found on our travels | FileCache.h | |
| PendingFiles | TArray< FString > | A list of files we have recursively found on our travels | FileCache.h | |
| RootPath | FString | Path to the root directory we want to scan | FileCache.h | |
| StandardRootPath | FString | Standardized path to the root directory we want to scan | FileCache.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TOptional< FDirectoryState > GetCachedState() |
Retrieve the cached state supplied to this class through UseCachedState(). | FileCache.h | |
TArray< FFilenameAndHash > GetFilesThatNeedHashing() |
Retrieve the cached state supplied to this class through UseCachedState(). | FileCache.h | |
TOptional< FDirectoryState > GetLiveState () |
Get the state of the directory once finished. | FileCache.h | |
void SetMatchRules
(
const FMatchRules& InRules |
Set what files are relevant to this reader. | FileCache.h | |
void UseCachedState
(
FDirectoryState InCachedState |
Instruct the directory reader to use the specified cached state to lookup file hashes, where timestamps haven't changed | FileCache.h |
Overridden from IAsyncFileCacheTask
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool IsComplete() |
Returns true when this directory reader has finished scanning the directory | FileCache.h | |
virtual EProgressResult Tick
(
const FTimeLimit& Limit |
Tick this reader (discover new directories / files). Returns progress state. | FileCache.h |