UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FFileManagerGeneric Class Reference

#include <FileManagerGeneric.h>

+ Inheritance diagram for FFileManagerGeneric:

Public Member Functions

 FFileManagerGeneric ()
 
virtual ~FFileManagerGeneric ()
 
virtual CORE_API void ProcessCommandLineOptions () override
 
virtual void SetSandboxEnabled (bool bInEnabled) override
 
virtual bool IsSandboxEnabled () const override
 
FArchiveCreateFileReader (const TCHAR *Filename, uint32 ReadFlags=0) override
 
FArchiveCreateFileWriter (const TCHAR *Filename, uint32 WriteFlags=0) override
 
CORE_API bool Delete (const TCHAR *Filename, bool RequireExists=0, bool EvenReadOnly=0, bool Quiet=0) override
 
CORE_API bool IsReadOnly (const TCHAR *Filename) override
 
CORE_API bool Move (const TCHAR *Dest, const TCHAR *Src, bool Replace=1, bool EvenIfReadOnly=0, bool Attributes=0, bool bDoNotRetryOrError=0) override
 
CORE_API bool FileExists (const TCHAR *Filename) override
 
CORE_API bool DirectoryExists (const TCHAR *InDirectory) override
 
CORE_API void FindFiles (TArray< FString > &Result, const TCHAR *Filename, bool Files, bool Directories) override
 
CORE_API void FindFilesRecursive (TArray< FString > &FileNames, const TCHAR *StartDirectory, const TCHAR *Filename, bool Files, bool Directories, bool bClearFileNames=true) override
 
CORE_API double GetFileAgeSeconds (const TCHAR *Filename) override
 
CORE_API FDateTime GetTimeStamp (const TCHAR *Filename) override
 
CORE_API FDateTime GetAccessTimeStamp (const TCHAR *Filename) override
 
CORE_API void GetTimeStampPair (const TCHAR *PathA, const TCHAR *PathB, FDateTime &OutTimeStampA, FDateTime &OutTimeStampB)
 
CORE_API bool SetTimeStamp (const TCHAR *Filename, FDateTime Timestamp) override
 
virtual CORE_API FString GetFilenameOnDisk (const TCHAR *Filename) override
 
virtual CORE_API uint32 Copy (const TCHAR *Dest, const TCHAR *Src, bool Replace=1, bool EvenIfReadOnly=0, bool Attributes=0, FCopyProgress *Progress=nullptr, EFileRead ReadFlags=FILEREAD_None, EFileWrite WriteFlags=FILEWRITE_None) override
 
virtual CORE_API bool MakeDirectory (const TCHAR *Path, bool Tree=0) override
 
virtual CORE_API bool DeleteDirectory (const TCHAR *Path, bool RequireExists=0, bool Tree=0) override
 
virtual CORE_API FFileStatData GetStatData (const TCHAR *FilenameOrDirectory) override
 
virtual CORE_API void FindFiles (TArray< FString > &FoundFiles, const TCHAR *Directory, const TCHAR *FileExtension=nullptr) override
 
CORE_API bool IterateDirectory (const TCHAR *Directory, IPlatformFile::FDirectoryVisitor &Visitor) override
 
CORE_API bool IterateDirectory (const TCHAR *Directory, IPlatformFile::FDirectoryVisitorFunc Visitor) override
 
CORE_API bool IterateDirectoryRecursively (const TCHAR *Directory, IPlatformFile::FDirectoryVisitor &Visitor) override
 
CORE_API bool IterateDirectoryRecursively (const TCHAR *Directory, IPlatformFile::FDirectoryVisitorFunc Visitor) override
 
CORE_API bool IterateDirectoryStat (const TCHAR *Directory, IPlatformFile::FDirectoryStatVisitor &Visitor) override
 
CORE_API bool IterateDirectoryStat (const TCHAR *Directory, IPlatformFile::FDirectoryStatVisitorFunc Visitor) override
 
CORE_API bool IterateDirectoryStatRecursively (const TCHAR *Directory, IPlatformFile::FDirectoryStatVisitor &Visitor) override
 
CORE_API bool IterateDirectoryStatRecursively (const TCHAR *Directory, IPlatformFile::FDirectoryStatVisitorFunc Visitor) override
 
CORE_API FString ConvertToRelativePath (const TCHAR *Filename) override
 
CORE_API FString ConvertToAbsolutePathForExternalAppForRead (const TCHAR *Filename) override
 
CORE_API FString ConvertToAbsolutePathForExternalAppForWrite (const TCHAR *Filename) override
 
CORE_API int64 FileSize (const TCHAR *Filename) override
 
virtual bool SendMessageToServer (const TCHAR *Message, IPlatformFile::IFileServerMessageHandler *Handler) override
 

Static Public Member Functions

static CORE_API FString DefaultConvertToRelativePath (const TCHAR *Filename)
 
- Static Public Member Functions inherited from IFileManager
static CORE_API IFileManagerGet ()
 

Additional Inherited Members

- Protected Member Functions inherited from IFileManager
 IFileManager ()
 

Detailed Description

Base class for file managers.

This base class simplifies IFileManager implementations by providing simple, unoptimized implementations of functions whose implementations can be derived from other functions.

Constructor & Destructor Documentation

◆ FFileManagerGeneric()

FFileManagerGeneric::FFileManagerGeneric ( )
inline

Default constructor.

◆ ~FFileManagerGeneric()

virtual FFileManagerGeneric::~FFileManagerGeneric ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ ConvertToAbsolutePathForExternalAppForRead()

FString FFileManagerGeneric::ConvertToAbsolutePathForExternalAppForRead ( const TCHAR Filename)
overridevirtual

Converts passed in filename to use an absolute path (for reading)

Parameters
Filenamefilename to convert to use an absolute path, safe to pass in already using absolute path
Returns
filename using absolute path

Implements IFileManager.

◆ ConvertToAbsolutePathForExternalAppForWrite()

FString FFileManagerGeneric::ConvertToAbsolutePathForExternalAppForWrite ( const TCHAR Filename)
overridevirtual

Converts passed in filename to use an absolute path (for writing)

Parameters
Filenamefilename to convert to use an absolute path, safe to pass in already using absolute path
Returns
filename using absolute path

Implements IFileManager.

◆ ConvertToRelativePath()

FString FFileManagerGeneric::ConvertToRelativePath ( const TCHAR Filename)
overridevirtual

Converts passed in filename to use a relative path.

Parameters
Filenamefilename to convert to use a relative path
Returns
filename using relative path

Implements IFileManager.

◆ Copy()

uint32 FFileManagerGeneric::Copy ( const TCHAR Dest,
const TCHAR Src,
bool  Replace = 1,
bool  EvenIfReadOnly = 0,
bool  Attributes = 0,
FCopyProgress Progress = nullptr,
EFileRead  ReadFlags = FILEREAD_None,
EFileWrite  WriteFlags = FILEWRITE_None 
)
overridevirtual

Copies a file.

Implements IFileManager.

◆ CreateFileReader()

FArchive * FFileManagerGeneric::CreateFileReader ( const TCHAR Filename,
uint32  ReadFlags = 0 
)
inlineoverridevirtual

Opens a file for reading and create an FArchive which can be used to read from it.

Parameters
FilenamePath to the file to open
ReadFlagsAn optional bitfield of optional flags. For flag values see @See EFileRead
Returns
Returns a pointer to an FArchive when successful and a nullptr if the operation failed. Note that it is up to the caller to delete the FArchive when done.

Implements IFileManager.

◆ CreateFileWriter()

FArchive * FFileManagerGeneric::CreateFileWriter ( const TCHAR Filename,
uint32  WriteFlags = 0 
)
inlineoverridevirtual

Opens a file for writing and create an FArchive which can be used to write to it.

Parameters
FilenamePath to the desired location of the file
WriteFlagsAn optional bitfield of optional flags. For flag values see @See EFileWrite
Returns
Returns a pointer to an FArchive when successful and a nullptr if the operation failed. Note that it is up to the caller to delete the FArchive when done.

Implements IFileManager.

◆ DefaultConvertToRelativePath()

FString FFileManagerGeneric::DefaultConvertToRelativePath ( const TCHAR Filename)
static

Converts passed in filename to use a relative path.

Parameters
Filenamefilename to convert to use a relative path
Returns
filename using relative path

◆ Delete()

bool FFileManagerGeneric::Delete ( const TCHAR Filename,
bool  RequireExists = 0,
bool  EvenReadOnly = 0,
bool  Quiet = 0 
)
overridevirtual

Deletes a file.

Implements IFileManager.

◆ DeleteDirectory()

bool FFileManagerGeneric::DeleteDirectory ( const TCHAR Path,
bool  RequireExists = 0,
bool  Tree = 0 
)
overridevirtual

Deletes a directory.

Implements IFileManager.

◆ DirectoryExists()

bool FFileManagerGeneric::DirectoryExists ( const TCHAR InDirectory)
overridevirtual

Checks if a directory exists.

Implements IFileManager.

◆ FileExists()

bool FFileManagerGeneric::FileExists ( const TCHAR Filename)
overridevirtual

Checks if a file exists

Implements IFileManager.

◆ FileSize()

int64 FFileManagerGeneric::FileSize ( const TCHAR Filename)
overridevirtual

Returns the size of a file. (Thread-safe)

Parameters
FilenamePlatform-independent Unreal filename.
Returns
File size in bytes or INDEX_NONE if the file didn't exist.

Implements IFileManager.

◆ FindFiles() [1/2]

void FFileManagerGeneric::FindFiles ( TArray< FString > &  FoundFiles,
const TCHAR Directory,
const TCHAR FileExtension = nullptr 
)
overridevirtual

Finds all the files within the given directory, with optional file extension filter.

Parameters
Directory,theabsolute path to the directory to search. Ex: "C:\UE4\Pictures"
FileExtension,IfFileExtension is NULL, or an empty string "" then all files are found. Otherwise FileExtension can be of the form .EXT or just EXT and only files with that extension will be returned.
Returns
FoundFiles, All the files that matched the optional FileExtension filter, or all files if none was specified.

Implements IFileManager.

◆ FindFiles() [2/2]

void FFileManagerGeneric::FindFiles ( TArray< FString > &  FileNames,
const TCHAR Filename,
bool  Files,
bool  Directories 
)
overridevirtual

Finds file or directories.

Implements IFileManager.

◆ FindFilesRecursive()

void FFileManagerGeneric::FindFilesRecursive ( TArray< FString > &  FileNames,
const TCHAR StartDirectory,
const TCHAR Filename,
bool  Files,
bool  Directories,
bool  bClearFileNames = true 
)
overridevirtual

Finds file or directories recursively.

Implements IFileManager.

◆ GetAccessTimeStamp()

FDateTime FFileManagerGeneric::GetAccessTimeStamp ( const TCHAR Filename)
overridevirtual
Returns
the last access time of the given file (or FDateTime::MinValue() on failure)

Implements IFileManager.

◆ GetFileAgeSeconds()

double FFileManagerGeneric::GetFileAgeSeconds ( const TCHAR Filename)
overridevirtual

Gets the age of a file measured in seconds.

Implements IFileManager.

◆ GetFilenameOnDisk()

FString FFileManagerGeneric::GetFilenameOnDisk ( const TCHAR Filename)
overridevirtual

For case insensitive filesystems, returns the full path of the file with the same case as in the filesystem.

Parameters
FilenameFilename to query
Returns
Filename with the same case as in the filesystem.

Implements IFileManager.

◆ GetStatData()

FFileStatData FFileManagerGeneric::GetStatData ( const TCHAR FilenameOrDirectory)
overridevirtual

Return the stat data for the given file or directory. Check the FFileStatData::bIsValid member before using the returned data

Implements IFileManager.

◆ GetTimeStamp()

FDateTime FFileManagerGeneric::GetTimeStamp ( const TCHAR Path)
overridevirtual
Returns
the modification time of the given file (or FDateTime::MinValue() on failure)

Implements IFileManager.

◆ GetTimeStampPair()

void FFileManagerGeneric::GetTimeStampPair ( const TCHAR PathA,
const TCHAR PathB,
FDateTime OutTimeStampA,
FDateTime OutTimeStampB 
)
virtual
Parameters
[in]PathAThe first given file
[in]PathBThe second given file
[out]OutTimeStampAthe modification time of the first given file (or FDateTime::MinValue() on failure)
[out]OutTimeStampBthe modification time of the second given file (or FDateTime::MinValue() on failure)

Implements IFileManager.

◆ IsReadOnly()

bool FFileManagerGeneric::IsReadOnly ( const TCHAR Filename)
overridevirtual

Checks if a file is read-only.

Implements IFileManager.

◆ IsSandboxEnabled()

virtual bool FFileManagerGeneric::IsSandboxEnabled ( ) const
inlineoverridevirtual

Returns whether the sandbox is enabled or not

Implements IFileManager.

◆ IterateDirectory() [1/2]

bool FFileManagerGeneric::IterateDirectory ( const TCHAR Directory,
IPlatformFile::FDirectoryVisitor Visitor 
)
overridevirtual

Call the Visit function of the visitor once for each file or directory in a single directory. This function does not explore subdirectories.

Parameters
DirectoryThe directory to iterate the contents of.
VisitorVisitor to call for each element of the directory
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ IterateDirectory() [2/2]

bool FFileManagerGeneric::IterateDirectory ( const TCHAR Directory,
IPlatformFile::FDirectoryVisitorFunc  Visitor 
)
overridevirtual

Call the visitor once for each file or directory in a single directory. This function does not explore subdirectories.

Parameters
DirectoryThe directory to iterate the contents of.
VisitorVisitor to call for each element of the directory (see FDirectoryVisitor::Visit for the signature)
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ IterateDirectoryRecursively() [1/2]

bool FFileManagerGeneric::IterateDirectoryRecursively ( const TCHAR Directory,
IPlatformFile::FDirectoryVisitor Visitor 
)
overridevirtual

Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.

Parameters
DirectoryThe directory to iterate the contents of, recursively.
VisitorVisitor to call for each element of the directory and each element of all subdirectories.
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ IterateDirectoryRecursively() [2/2]

bool FFileManagerGeneric::IterateDirectoryRecursively ( const TCHAR Directory,
IPlatformFile::FDirectoryVisitorFunc  Visitor 
)
overridevirtual

Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.

Parameters
DirectoryThe directory to iterate the contents of, recursively.
VisitorVisitor to call for each element of the directory and each element of all subdirectories (see FDirectoryVisitor::Visit for the signature).
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ IterateDirectoryStat() [1/2]

bool FFileManagerGeneric::IterateDirectoryStat ( const TCHAR Directory,
IPlatformFile::FDirectoryStatVisitor Visitor 
)
overridevirtual

Call the Visit function of the visitor once for each file or directory in a single directory. This function does not explore subdirectories.

Parameters
DirectoryThe directory to iterate the contents of.
VisitorVisitor to call for each element of the directory
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ IterateDirectoryStat() [2/2]

bool FFileManagerGeneric::IterateDirectoryStat ( const TCHAR Directory,
IPlatformFile::FDirectoryStatVisitorFunc  Visitor 
)
overridevirtual

Call the visitor once for each file or directory in a single directory. This function does not explore subdirectories.

Parameters
DirectoryThe directory to iterate the contents of.
VisitorVisitor to call for each element of the directory (see FDirectoryStatVisitor::Visit for the signature)
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ IterateDirectoryStatRecursively() [1/2]

bool FFileManagerGeneric::IterateDirectoryStatRecursively ( const TCHAR Directory,
IPlatformFile::FDirectoryStatVisitor Visitor 
)
overridevirtual

Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.

Parameters
DirectoryThe directory to iterate the contents of, recursively.
VisitorVisitor to call for each element of the directory and each element of all subdirectories.
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ IterateDirectoryStatRecursively() [2/2]

bool FFileManagerGeneric::IterateDirectoryStatRecursively ( const TCHAR Directory,
IPlatformFile::FDirectoryStatVisitorFunc  Visitor 
)
overridevirtual

Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.

Parameters
DirectoryThe directory to iterate the contents of, recursively.
VisitorVisitor to call for each element of the directory and each element of all subdirectories (see FDirectoryStatVisitor::Visit for the signature).
Returns
false if the directory did not exist or if the visitor returned false.

Implements IFileManager.

◆ MakeDirectory()

bool FFileManagerGeneric::MakeDirectory ( const TCHAR Path,
bool  Tree = 0 
)
overridevirtual

Creates a directory.

Implements IFileManager.

◆ Move()

bool FFileManagerGeneric::Move ( const TCHAR Dest,
const TCHAR Src,
bool  Replace = 1,
bool  EvenIfReadOnly = 0,
bool  Attributes = 0,
bool  bDoNotRetryOrError = 0 
)
overridevirtual

Moves/renames a file.

Implements IFileManager.

◆ ProcessCommandLineOptions()

void FFileManagerGeneric::ProcessCommandLineOptions ( )
overridevirtual

Allow the file manager to handle the commandline

Implements IFileManager.

◆ SendMessageToServer()

virtual bool FFileManagerGeneric::SendMessageToServer ( const TCHAR Message,
IPlatformFile::IFileServerMessageHandler Handler 
)
inlineoverridevirtual

Sends a message to the file server, and will block until it's complete. Will return immediately if the file manager doesn't support talking to a server.

Parameters
MessageThe string message to send to the server
Returns
true if the message was sent to server and it returned success, or false if there is no server, or the command failed

Implements IFileManager.

◆ SetSandboxEnabled()

virtual void FFileManagerGeneric::SetSandboxEnabled ( bool  bInEnabled)
inlineoverridevirtual

Enables/disables the sandbox, if it is being used

Implements IFileManager.

◆ SetTimeStamp()

bool FFileManagerGeneric::SetTimeStamp ( const TCHAR Path,
FDateTime  TimeStamp 
)
overridevirtual

Sets the modification time of the given file

Implements IFileManager.


The documentation for this class was generated from the following files: