UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IPlatformFile Class Referenceabstract

#include <GenericPlatformFile.h>

+ Inheritance diagram for IPlatformFile:

Classes

class  FDirectoryStatVisitor
 
class  FDirectoryVisitor
 
class  IFileServerMessageHandler
 

Public Types

enum class  EOpenReadFlags : uint8 { None = 0 , AllowWrite = 1 << 0 , AllowDelete = 1 << 1 , NoBuffering = 1 << 2 }
 
enum class  EOpenWriteFlags : uint8 { None = 0 , AllowRead = 1 << 0 , Append = 1 << 1 }
 
typedef TFunctionRef< bool(const TCHAR *, bool)> FDirectoryVisitorFunc
 
typedef TFunctionRef< bool(const TCHAR *, const FFileStatData &)> FDirectoryStatVisitorFunc
 
typedef TFunctionRef< bool(const TCHAR *, const FFileJournalData &)> FDirectoryJournalVisitorFunc
 

Public Member Functions

CORE_API IPlatformFile ()
 
virtual CORE_API ~IPlatformFile ()
 
virtual void SetSandboxEnabled (bool bInEnabled)
 
virtual bool IsSandboxEnabled () const
 
virtual bool ShouldBeUsed (IPlatformFile *Inner, const TCHAR *CmdLine) const
 
virtual bool Initialize (IPlatformFile *Inner, const TCHAR *CmdLine)=0
 
virtual void InitializeAfterSetActive ()
 
virtual void InitializeAfterProjectFilePath ()
 
virtual void MakeUniquePakFilesForTheseFiles (const TArray< TArray< FString > > &InFiles)
 
virtual void InitializeNewAsyncIO ()
 
virtual void AddLocalDirectories (TArray< FString > &LocalDirectories)
 
virtual void BypassSecurity (bool bInBypass)
 
virtual void Tick ()
 
virtual IPlatformFileGetLowerLevel ()=0
 
virtual void SetLowerLevel (IPlatformFile *NewLowerLevel)=0
 
virtual const TCHARGetName () const =0
 
virtual bool FileExists (const TCHAR *Filename)=0
 
virtual int64 FileSize (const TCHAR *Filename)=0
 
virtual bool DeleteFile (const TCHAR *Filename)=0
 
virtual bool DeleteFiles (const TArrayView< const TCHAR * > &Filenames)
 
virtual bool IsReadOnly (const TCHAR *Filename)=0
 
virtual bool MoveFile (const TCHAR *To, const TCHAR *From)=0
 
virtual bool SetReadOnly (const TCHAR *Filename, bool bNewReadOnlyValue)=0
 
virtual FDateTime GetTimeStamp (const TCHAR *Filename)=0
 
virtual void SetTimeStamp (const TCHAR *Filename, FDateTime DateTime)=0
 
virtual FDateTime GetAccessTimeStamp (const TCHAR *Filename)=0
 
virtual FString GetFilenameOnDisk (const TCHAR *Filename)=0
 
virtual ESymlinkResult IsSymlink (const TCHAR *Filename)
 
virtual bool HasMarkOfTheWeb (FStringView Filename, FString *OutSourceURL=nullptr)
 
virtual bool SetMarkOfTheWeb (FStringView Filename, bool bNewStatus, const FString *InSourceURL=nullptr)
 
virtual CORE_API FFileOpenResult OpenRead (const TCHAR *Filename, EOpenReadFlags Flags)
 
virtual IFileHandleOpenRead (const TCHAR *Filename, bool bAllowWrite=false)=0
 
virtual FFileOpenResult OpenReadNoBuffering (const TCHAR *Filename, EOpenReadFlags Flags)
 
virtual IFileHandleOpenReadNoBuffering (const TCHAR *Filename, bool bAllowWrite=false)
 
virtual IFileHandleOpenWrite (const TCHAR *Filename, bool bAppend=false, bool bAllowRead=false)=0
 
virtual CORE_API FFileOpenResult OpenWrite (const TCHAR *Filename, EOpenWriteFlags Flags)
 
virtual bool DirectoryExists (const TCHAR *Directory)=0
 
virtual bool CreateDirectory (const TCHAR *Directory)=0
 
virtual bool DeleteDirectory (const TCHAR *Directory)=0
 
virtual FFileStatData GetStatData (const TCHAR *FilenameOrDirectory)=0
 
virtual bool IterateDirectory (const TCHAR *Directory, FDirectoryVisitor &Visitor)=0
 
virtual bool IterateDirectoryStat (const TCHAR *Directory, FDirectoryStatVisitor &Visitor)=0
 
virtual CORE_API bool FileJournalIsAvailable (const TCHAR *VolumeOrPath=nullptr, ELogVerbosity::Type *OutErrorLevel=nullptr, FString *OutError=nullptr)
 
virtual CORE_API uint64 FileJournalGetMaximumSize (const TCHAR *VolumeOrPath=nullptr, ELogVerbosity::Type *OutErrorLevel=nullptr, FString *OutError=nullptr) const
 
virtual CORE_API EFileJournalResult FileJournalGetLatestEntry (const TCHAR *VolumeName, FFileJournalId &OutJournalId, FFileJournalEntryHandle &OutEntryHandle, FString *OutError=nullptr)
 
virtual CORE_API bool FileJournalIterateDirectory (const TCHAR *Directory, FDirectoryJournalVisitorFunc Visitor, FString *OutError=nullptr)
 
virtual CORE_API FFileJournalData FileJournalGetFileData (const TCHAR *FilenameOrDirectory, FString *OutError=nullptr)
 
virtual CORE_API EFileJournalResult FileJournalReadModified (const TCHAR *VolumeName, const FFileJournalId &JournalIdOfStartingEntry, const FFileJournalEntryHandle &StartingJournalEntry, TMap< FFileJournalFileHandle, FString > &KnownDirectories, TSet< FString > &OutModifiedDirectories, FFileJournalEntryHandle &OutNextJournalEntry, FString *OutError=nullptr)
 
virtual CORE_API FString FileJournalGetVolumeName (FStringView InPath)
 
virtual CORE_API FFileOpenAsyncResult OpenAsyncRead (const TCHAR *Filename, EOpenReadFlags Flags)
 
virtual CORE_API IAsyncReadFileHandleOpenAsyncRead (const TCHAR *Filename, bool bAllowWrite=false)
 
virtual void SetAsyncMinimumPriority (EAsyncIOPriorityAndFlags MinPriority)
 
virtual CORE_API IMappedFileHandleOpenMapped (const TCHAR *Filename)
 
virtual CORE_API FOpenMappedResult OpenMappedEx (const TCHAR *Filename, EOpenReadFlags OpenOptions=EOpenReadFlags::None, int64 MaximumSize=0)
 
virtual CORE_API void GetTimeStampPair (const TCHAR *PathA, const TCHAR *PathB, FDateTime &OutTimeStampA, FDateTime &OutTimeStampB)
 
virtual CORE_API FDateTime GetTimeStampLocal (const TCHAR *Filename)
 
virtual CORE_API bool IterateDirectory (const TCHAR *Directory, FDirectoryVisitorFunc Visitor)
 
virtual CORE_API bool IterateDirectoryStat (const TCHAR *Directory, FDirectoryStatVisitorFunc Visitor)
 
virtual CORE_API bool IterateDirectoryRecursively (const TCHAR *Directory, FDirectoryVisitor &Visitor)
 
virtual CORE_API bool IterateDirectoryStatRecursively (const TCHAR *Directory, FDirectoryStatVisitor &Visitor)
 
virtual CORE_API bool IterateDirectoryRecursively (const TCHAR *Directory, FDirectoryVisitorFunc Visitor)
 
virtual CORE_API bool IterateDirectoryStatRecursively (const TCHAR *Directory, FDirectoryStatVisitorFunc Visitor)
 
virtual CORE_API void FindFiles (TArray< FString > &FoundFiles, const TCHAR *Directory, const TCHAR *FileExtension)
 
virtual CORE_API void FindFilesRecursively (TArray< FString > &FoundFiles, const TCHAR *Directory, const TCHAR *FileExtension)
 
virtual CORE_API bool DeleteDirectoryRecursively (const TCHAR *Directory)
 
virtual CORE_API bool CreateDirectoryTree (const TCHAR *Directory)
 
virtual CORE_API bool CopyFile (const TCHAR *To, const TCHAR *From, EPlatformFileRead ReadFlags=EPlatformFileRead::None, EPlatformFileWrite WriteFlags=EPlatformFileWrite::None)
 
virtual CORE_API bool CopyDirectoryTree (const TCHAR *DestinationDirectory, const TCHAR *Source, bool bOverwriteAllExisting)
 
virtual CORE_API FString ConvertToAbsolutePathForExternalAppForRead (const TCHAR *Filename)
 
virtual CORE_API FString ConvertToAbsolutePathForExternalAppForWrite (const TCHAR *Filename)
 
virtual bool SendMessageToServer (const TCHAR *Message, IFileServerMessageHandler *Handler)
 
virtual bool DoesCreatePublicFiles ()
 
virtual void SetCreatePublicFiles (bool bCreatePublicFiles)
 
virtual int64 GetAllowedBytesToWriteThrottledStorage (const TCHAR *DestinationPath=nullptr)
 

Static Public Member Functions

static CORE_API IPlatformFileGetPlatformPhysical ()
 
static CORE_API const TCHARGetPhysicalTypeName ()
 

Detailed Description

File I/O Interface

Member Typedef Documentation

◆ FDirectoryJournalVisitorFunc

File and directory visitor function that takes FileJournal data.

◆ FDirectoryStatVisitorFunc

File and directory visitor function that takes all the stat data

◆ FDirectoryVisitorFunc

File and directory visitor function that takes only the name

Member Enumeration Documentation

◆ EOpenReadFlags

Flags to be used when opening a file for reading via IPlatformFile::OpenRead

Enumerator
None 
AllowWrite 

Allow other handles/processes to write to this file. This flag is needed to open files that are currently being written to as well

AllowDelete 

Allow the file to be deleted or renamed while keeping this handle valid for reading.

NoBuffering 

Disables buffering performed by the platform operating system, if any. Note, this typically requires read offsets, and read sizes to be multiples of the volume's sector size, as well as the buffer being read into being aligned to a multiple of the physical sector size. Avoid using if you cannot control these parameters.

◆ EOpenWriteFlags

Flags to be used when opening a file for writing.

Enumerator
None 

No additional flags.

AllowRead 

Allow other handles/processes to read from this file.

Append 

Append to file.

Constructor & Destructor Documentation

◆ IPlatformFile()

IPlatformFile::IPlatformFile ( )
default

Constructor/Destructor.

◆ ~IPlatformFile()

IPlatformFile::~IPlatformFile ( )
virtualdefault

Member Function Documentation

◆ AddLocalDirectories()

virtual void IPlatformFile::AddLocalDirectories ( TArray< FString > &  LocalDirectories)
inlinevirtual

Identifies any platform specific paths that are guaranteed to be local (i.e. cache, scratch space)

◆ BypassSecurity()

virtual void IPlatformFile::BypassSecurity ( bool  bInBypass)
inlinevirtual

◆ ConvertToAbsolutePathForExternalAppForRead()

FString IPlatformFile::ConvertToAbsolutePathForExternalAppForRead ( const TCHAR Filename)
virtual

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

Reimplemented in IAndroidPlatformFile, FCachedReadPlatformFile, FPlatformFileOpenLog, FIOSPlatformFile, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, FStorageServerPlatformFile, and FStreamingNetworkPlatformFile.

◆ ConvertToAbsolutePathForExternalAppForWrite()

FString IPlatformFile::ConvertToAbsolutePathForExternalAppForWrite ( const TCHAR Filename)
virtual

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

Reimplemented in IAndroidPlatformFile, FCachedReadPlatformFile, FPlatformFileOpenLog, FIOSPlatformFile, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, FStorageServerPlatformFile, and FStreamingNetworkPlatformFile.

◆ CopyDirectoryTree()

bool IPlatformFile::CopyDirectoryTree ( const TCHAR DestinationDirectory,
const TCHAR Source,
bool  bOverwriteAllExisting 
)
virtual

Copy a file or a hierarchy of files (directory).

Parameters
DestinationDirectoryTarget path (either absolute or relative) to copy to - always a directory! (e.g. "/home/dest/").
SourceSource file (or directory) to copy (e.g. "/home/source/stuff").
bOverwriteAllExistingWhether to overwrite everything that exists at target
Returns
true if operation completed successfully.

Reimplemented in FCachedReadPlatformFile, and FPlatformFileOpenLog.

◆ CopyFile()

bool IPlatformFile::CopyFile ( const TCHAR To,
const TCHAR From,
EPlatformFileRead  ReadFlags = EPlatformFileRead::None,
EPlatformFileWrite  WriteFlags = EPlatformFileWrite::None 
)
virtual

Copy a file. This will fail if the destination file already exists.

Parameters
ToFile to copy to.
FromFile to copy from.
ReadFlagsSource file read options.
WriteFlagsDestination file write options.
Returns
true if the file was copied successfully.

Reimplemented in FApplePlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FUnixPlatformFile, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStreamingNetworkPlatformFile.

◆ CreateDirectory()

virtual bool IPlatformFile::CreateDirectory ( const TCHAR Directory)
pure virtual

◆ CreateDirectoryTree()

bool IPlatformFile::CreateDirectoryTree ( const TCHAR Directory)
virtual

Create a directory, including any parent directories and return true if the directory was created or already existed.

Reimplemented in FCachedReadPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStreamingNetworkPlatformFile.

◆ DeleteDirectory()

virtual bool IPlatformFile::DeleteDirectory ( const TCHAR Directory)
pure virtual

◆ DeleteDirectoryRecursively()

bool IPlatformFile::DeleteDirectoryRecursively ( const TCHAR Directory)
virtual

Delete all files and subdirectories in a directory, then delete the directory itself

Parameters
DirectoryThe directory to delete.
Returns
true if the directory was deleted or did not exist.

Reimplemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStreamingNetworkPlatformFile.

◆ DeleteFile()

virtual bool IPlatformFile::DeleteFile ( const TCHAR Filename)
pure virtual

◆ DeleteFiles()

virtual bool IPlatformFile::DeleteFiles ( const TArrayView< const TCHAR * > &  Filenames)
inlinevirtual

Delete an array of files and return true if ALL deletes are succeeded.

◆ DirectoryExists()

◆ DoesCreatePublicFiles()

virtual bool IPlatformFile::DoesCreatePublicFiles ( )
inlinevirtual

Checks to see if this file system creates publicly accessible files

Returns
true if this file system creates publicly accessible files

Reimplemented in FIOSPlatformFile.

◆ FileExists()

◆ FileJournalGetFileData()

FFileJournalData IPlatformFile::FileJournalGetFileData ( const TCHAR FilenameOrDirectory,
FString *  OutError = nullptr 
)
virtual

Return the data for the given path as with GetStatData, but report a FFileJournalData instead, which notably includes the FFileJournalFileHandle for the file/directory. Check the FFileJournalData::bIsValid member before using the returned data

Reimplemented in FWindowsPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, and FPlatformFileOpenLog.

◆ FileJournalGetLatestEntry()

EFileJournalResult IPlatformFile::FileJournalGetLatestEntry ( const TCHAR VolumeName,
FFileJournalId OutJournalId,
FFileJournalEntryHandle OutEntryHandle,
FString *  OutError = nullptr 
)
virtual

Report the current end of the journal for the given volume, to be used as the StartingJournalEntry in FileJournalGetModifiedDirectories. If !FileJournalIsAvaiable for the given volume, sets OutEntryHandle to FileJournalEntryHandleInvalid. Returns EFileJournalResult::Success if successful, otherwise an error code and optionally a user-displayable explanation for the error code.

Reimplemented in FWindowsPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, and FPlatformFileOpenLog.

◆ FileJournalGetMaximumSize()

uint64 IPlatformFile::FileJournalGetMaximumSize ( const TCHAR VolumeOrPath = nullptr,
ELogVerbosity::Type OutErrorLevel = nullptr,
FString *  OutError = nullptr 
) const
virtual

Return the maximum size of the FileJournal for the specified VolumeName, if available, zero otherwise. Optionally returns a user-displayable string for why the journal is not available and a severity level for the reason. VolumeName may be a VolumeName as returned by FileJournalGetVolumeName or any path to a file or directory on the Volume.

Reimplemented in FWindowsPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, and FPlatformFileOpenLog.

◆ FileJournalGetVolumeName()

FString IPlatformFile::FileJournalGetVolumeName ( FStringView  InPath)
virtual

Return the VolumeSpecifier present in the given path. Returns empty string if path does not have a valid volume specifier for use by the FileJournal (e.g. some platforms do not support \paths for FileJournal).

See also
FPathViews::SplitVolumeSpecifier for a more general function that can return specifiers not usable by the FileJournal.

Reimplemented in FWindowsPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, and FPlatformFileOpenLog.

◆ FileJournalIsAvailable()

bool IPlatformFile::FileJournalIsAvailable ( const TCHAR VolumeOrPath = nullptr,
ELogVerbosity::Type OutErrorLevel = nullptr,
FString *  OutError = nullptr 
)
virtual

Return whether FileJournal functionality is available on the current platform if VolumeName is nullptr or for the given Volume if VolumeName is non-null. Optionally returns a user-displayable string for why it is not available and a severity level for the reason. VolumeName may be a VolumeName as returned by FileJournalGetVolumeName or any path to a file or directory on the Volume.

Reimplemented in FWindowsPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, and FPlatformFileOpenLog.

◆ FileJournalIterateDirectory()

bool IPlatformFile::FileJournalIterateDirectory ( const TCHAR Directory,
FDirectoryJournalVisitorFunc  Visitor,
FString *  OutError = nullptr 
)
virtual

Iterate the given directory as with IterateDirectoryStat, but report a FFileJournalData for each file and directory, which notably includes the FFileJournalFileHandle for the file/directory.

The paths returned as the first argument of the visitor function are the combined paths produced by combining the input directory with the relative path of the child file or directory.

If the FileJournal is unavailable on the current system the iteration will still succeed but the FFileJournalFileHandle for each child path will be set to FileJournalFileHandleInvalid.

If the FileJournal is available on the current system but not on the volume of the given directory, it is arbitrary whether the FFileJournalFileHandle will be validly set; if not valid they will be set to FileJournalFileHandleInvalid.

Returns
false if the directory did not exist or if the visitor returned false.

Reimplemented in FWindowsPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, and FPlatformFileOpenLog.

◆ FileJournalReadModified()

EFileJournalResult IPlatformFile::FileJournalReadModified ( const TCHAR VolumeName,
const FFileJournalId JournalIdOfStartingEntry,
const FFileJournalEntryHandle StartingJournalEntry,
TMap< FFileJournalFileHandle, FString > &  KnownDirectories,
TSet< FString > &  OutModifiedDirectories,
FFileJournalEntryHandle OutNextJournalEntry,
FString *  OutError = nullptr 
)
virtual

Query the FileJournal to find a list of all directories on the given volume with files that have been added, deleted, or modified in the specified time range. The beginning of the time range is specified by JournalIdOfStartingEntry and StartingJournalEntry, which came from FileJournalGetLatestEntry or a previous call to FileJournalReadModified. The end of the range is the latest modification on the volume. VolumeName can be the return value from FileJournalGetVolumeName, or any path on the desired volume.

The caller must provide the mapping from FFileJournalFileHandle to DirectoryName; the FFileJournalFileHandle for each Directory can be found from FileJournalGetFileData or FileJournalIterateDirectory.

Modified directories are appended into OutModifiedDirectories, and the next FileJournal entry to scan is written into OutNextJournalEntry.

Returns EFileJournalResult::Success if successful, otherwise an error code and optionally a user-displayable explanation for the error code. In an error case, partial results may still be written into the output.

Reimplemented in FWindowsPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, and FPlatformFileOpenLog.

◆ FileSize()

◆ FindFiles()

void IPlatformFile::FindFiles ( TArray< FString > &  FoundFiles,
const TCHAR Directory,
const TCHAR FileExtension 
)
virtual

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

Parameters
DirectoryThe directory to iterate the contents of
FileExtensionIf FileExtension 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.

Reimplemented in FCachedReadPlatformFile, and FPakPlatformFile.

◆ FindFilesRecursively()

void IPlatformFile::FindFilesRecursively ( TArray< FString > &  FoundFiles,
const TCHAR Directory,
const TCHAR FileExtension 
)
virtual

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

Parameters
DirectoryThe starting directory to iterate the contents. This function explores subdirectories
FileExtensionIf FileExtension 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.

Reimplemented in FCachedReadPlatformFile, and FPakPlatformFile.

◆ GetAccessTimeStamp()

◆ GetAllowedBytesToWriteThrottledStorage()

virtual int64 IPlatformFile::GetAllowedBytesToWriteThrottledStorage ( const TCHAR DestinationPath = nullptr)
inlinevirtual

Returns the number of bytes that are currently allowed to be written to throttled write storage (if the platform has such restrictions)

Parameters
DestinationPathIf specified, the file system can optionally take into account the destination of the file to determine the current limit
Returns
The number of bytes that are allowed to be written to write throttled storage.
If there is no limit, INT64_MAX is returned

◆ GetFilenameOnDisk()

virtual FString IPlatformFile::GetFilenameOnDisk ( const TCHAR Filename)
pure virtual

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

Implemented in FWindowsPlatformFile, FApplePlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FIOSPlatformFile, FUnixPlatformFile, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStorageServerPlatformFile.

◆ GetLowerLevel()

◆ GetName()

◆ GetPhysicalTypeName()

const TCHAR * IPlatformFile::GetPhysicalTypeName ( )
static

Returns the name of the physical platform file type.

◆ GetPlatformPhysical()

IPlatformFile & IPlatformFile::GetPlatformPhysical ( )
static

Physical file system of the platform, never wrapped.

iOS platform file declaration

◆ GetStatData()

virtual FFileStatData IPlatformFile::GetStatData ( const TCHAR FilenameOrDirectory)
pure virtual

◆ GetTimeStamp()

◆ GetTimeStampLocal()

FDateTime IPlatformFile::GetTimeStampLocal ( const TCHAR Filename)
virtual

Return the modification time of a file in the local time of the calling code (GetTimeStamp returns UTC). Returns FDateTime::MinValue() on failure

◆ GetTimeStampPair()

void IPlatformFile::GetTimeStampPair ( const TCHAR PathA,
const TCHAR PathB,
FDateTime OutTimeStampA,
FDateTime OutTimeStampB 
)
virtual

Reimplemented in FPakPlatformFile, and FNetworkPlatformFile.

◆ HasMarkOfTheWeb()

virtual bool IPlatformFile::HasMarkOfTheWeb ( FStringView  Filename,
FString *  OutSourceURL = nullptr 
)
inlinevirtual

Determine if the file has been downloaded from a web browser, based on platform-specific metadata.

Parameters
FilenameThe file to check if it has a mark of the web.
OutSourceURLAn optional pointer to return a source url if available.
Returns
true if the file has a mark of the web, false otherwise.
Remarks
Only works for files on disk and currently only implemented for Windows.

Reimplemented in FWindowsPlatformFile.

◆ Initialize()

virtual bool IPlatformFile::Initialize ( IPlatformFile Inner,
const TCHAR CmdLine 
)
pure virtual

Initializes platform file.

Parameters
InnerPlatform file to wrap by this file.
CmdLineCommand line to parse.
Returns
true if the initialization was successful, false otherise.

Implemented in IPhysicalPlatformFile, FNetworkPlatformFile, FSandboxPlatformFile, FStorageServerPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, and FPakPlatformFile.

◆ InitializeAfterProjectFilePath()

virtual void IPlatformFile::InitializeAfterProjectFilePath ( )
inlinevirtual

Performs initialization of the platform file after the project path has been set.

Reimplemented in FStorageServerPlatformFile.

◆ InitializeAfterSetActive()

virtual void IPlatformFile::InitializeAfterSetActive ( )
inlinevirtual

Performs initialization of the platform file after it has become the active (FPlatformFileManager.GetPlatformFile() will return this

Reimplemented in FNetworkPlatformFile, and FStreamingNetworkPlatformFile.

◆ InitializeNewAsyncIO()

virtual void IPlatformFile::InitializeNewAsyncIO ( )
inlinevirtual

Performs initialization of the platform file after the new async IO has been enabled

Reimplemented in FPakPlatformFile.

◆ IsReadOnly()

◆ IsSandboxEnabled()

virtual bool IPlatformFile::IsSandboxEnabled ( ) const
inlinevirtual

Returns whether the sandbox is enabled or not

Returns
bool true if enabled, false if not

Reimplemented in FSandboxPlatformFile.

◆ IsSymlink()

virtual ESymlinkResult IPlatformFile::IsSymlink ( const TCHAR Filename)
inlinevirtual

Return true if the file is a symbolic link

Reimplemented in FWindowsPlatformFile, FApplePlatformFile, FUnixPlatformFile, and FPakPlatformFile.

◆ IterateDirectory() [1/2]

virtual bool IPlatformFile::IterateDirectory ( const TCHAR Directory,
FDirectoryVisitor Visitor 
)
pure virtual

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.

Implemented in FWindowsPlatformFile, FApplePlatformFile, FIOSPlatformFile, FUnixPlatformFile, FStorageServerPlatformFile, IAndroidPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, FSandboxPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStreamingNetworkPlatformFile.

◆ IterateDirectory() [2/2]

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

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.

Reimplemented in IAndroidPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, and FSandboxPlatformFile.

◆ IterateDirectoryRecursively() [1/2]

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

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.

Reimplemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, FSandboxPlatformFile, FStorageServerPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStreamingNetworkPlatformFile.

◆ IterateDirectoryRecursively() [2/2]

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

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.

Reimplemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, and FSandboxPlatformFile.

◆ IterateDirectoryStat() [1/2]

virtual bool IPlatformFile::IterateDirectoryStat ( const TCHAR Directory,
FDirectoryStatVisitor Visitor 
)
pure virtual

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.

Implemented in FWindowsPlatformFile, FApplePlatformFile, FIOSPlatformFile, FUnixPlatformFile, FStorageServerPlatformFile, IAndroidPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, FSandboxPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, FPakPlatformFile, and FSandboxPlatformFile.

◆ IterateDirectoryStat() [2/2]

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

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.

Reimplemented in IAndroidPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, and FSandboxPlatformFile.

◆ IterateDirectoryStatRecursively() [1/2]

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

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.

Reimplemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, FSandboxPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, FPakPlatformFile, and FSandboxPlatformFile.

◆ IterateDirectoryStatRecursively() [2/2]

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

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.

Reimplemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, and FSandboxPlatformFile.

◆ MakeUniquePakFilesForTheseFiles()

virtual void IPlatformFile::MakeUniquePakFilesForTheseFiles ( const TArray< TArray< FString > > &  InFiles)
inlinevirtual

Build an in memory unique pak file from a subset of files in this pak file

Reimplemented in FPakPlatformFile.

◆ MoveFile()

virtual bool IPlatformFile::MoveFile ( const TCHAR To,
const TCHAR From 
)
pure virtual

◆ OpenAsyncRead() [1/2]

IAsyncReadFileHandle * IPlatformFile::OpenAsyncRead ( const TCHAR Filename,
bool  bAllowWrite = false 
)
virtual

Open a file for async reading. This call does not hit the disk or block.

Parameters
Filenamefile to be opened
bAllowWrite(applies to certain platforms only) whether this file is allowed to be written to by other processes. This flag is needed to open files that are currently being written to as well.
Returns
Close the file by delete'ing the handle. A non-null return value does not mean the file exists, since that may not be determined yet.

Reimplemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FPakPlatformFile, and FSandboxPlatformFile.

◆ OpenAsyncRead() [2/2]

FFileOpenAsyncResult IPlatformFile::OpenAsyncRead ( const TCHAR Filename,
EOpenReadFlags  Flags 
)
virtual

Open a file for async reading. This call does not hit the disk or block.

Parameters
FlagsAllows specialization of the open operation,
See also
EReadFlags
Returns
The return value will either contain the valid file handle or an error message.
See also
FFileOpenAsyncResult

◆ OpenMapped()

IMappedFileHandle * IPlatformFile::OpenMapped ( const TCHAR Filename)
virtual

Open a file for async reading. This call does hit the disk; it is synchronous open.

Parameters
FilenameFile to be mapped. This doesn't actually map anything, just opens the file.
Returns
Close the file by deleting the handle. A non-null return value does mean the file exists. Null can be returned for many reasons even if the file exists. Perhaps this platform does not support mapped files, or this file is compressed in a pak file. Generally you attempt to open mapped, and if that fails, then use other file operations instead.

Reimplemented in FSandboxPlatformFile.

◆ OpenMappedEx()

FOpenMappedResult IPlatformFile::OpenMappedEx ( const TCHAR Filename,
EOpenReadFlags  OpenOptions = EOpenReadFlags::None,
int64  MaximumSize = 0 
)
virtual

Open a file for async reading. This call does hit the disk; it is synchronous open.

Parameters
FilenameFile to be mapped. This doesn't actually map anything, just opens the file.
OpenOptionsAllows specifying map to be writable via AllowWrite or be ReadOnly by deafault.
Returns
Close the file by deleting the handle. A non-null return value does mean the file exists. Null can be returned for many reasons even if the file exists. Perhaps this platform does not support mapped files, or this file is compressed in a pak file. Generally you attempt to open mapped, and if that fails, then use other file operations instead.

Reimplemented in FWindowsPlatformFile, FApplePlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FUnixPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStorageServerPlatformFile.

◆ OpenRead() [1/2]

virtual IFileHandle * IPlatformFile::OpenRead ( const TCHAR Filename,
bool  bAllowWrite = false 
)
pure virtual

Attempt to open a file for reading. Please consider using the new overload that takes EReadFlags instead of bools as parameters.

Parameters
Filenamefile to be opened
bAllowWrite(applies to certain platforms only) whether this file is allowed to be written to by other processes. This flag is needed to open files that are currently being written to as well.
Returns
If successful will return a non-nullptr pointer. Close the file by deleting the handle.

Implemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FWindowsPlatformFile, FApplePlatformFile, FIOSPlatformFile, FUnixPlatformFile, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, FStorageServerPlatformFile, and FStreamingNetworkPlatformFile.

◆ OpenRead() [2/2]

FFileOpenResult IPlatformFile::OpenRead ( const TCHAR Filename,
IPlatformFile::EOpenReadFlags  Flags 
)
virtual

Open a file handle for reading.

Parameters
FilenameThe file to be opened
FlagsAllows specialization of the open operation,
See also
EOpenReadFlags
Returns
The return value will either contain the valid file handle or an error message.
See also
FFileOpenResult

Reimplemented in FWindowsPlatformFile.

◆ OpenReadNoBuffering() [1/2]

virtual IFileHandle * IPlatformFile::OpenReadNoBuffering ( const TCHAR Filename,
bool  bAllowWrite = false 
)
inlinevirtual

Reimplemented in FWindowsPlatformFile.

◆ OpenReadNoBuffering() [2/2]

virtual FFileOpenResult IPlatformFile::OpenReadNoBuffering ( const TCHAR Filename,
EOpenReadFlags  Flags 
)
inlinevirtual

Reimplemented in FWindowsPlatformFile.

◆ OpenWrite() [1/2]

virtual IFileHandle * IPlatformFile::OpenWrite ( const TCHAR Filename,
bool  bAppend = false,
bool  bAllowRead = false 
)
pure virtual

Attempt to open a file for writing. If successful will return a non-nullptr pointer. Close the file by deleting the handle.

Implemented in FStreamingNetworkPlatformFile, FWindowsPlatformFile, FApplePlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FIOSPlatformFile, FUnixPlatformFile, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, and FStorageServerPlatformFile.

◆ OpenWrite() [2/2]

FFileOpenResult IPlatformFile::OpenWrite ( const TCHAR Filename,
EOpenWriteFlags  Flags 
)
virtual

Open a file handle for writing.

Parameters
FilenameThe file to be opened
FlagsAllows specialization of the open operation,
See also
EOpenWriteFlags
Returns
The return value will either contain the valid file handle or an error message.
See also
FFileOpenResult

◆ SendMessageToServer()

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

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

Reimplemented in FCachedReadPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, and FStorageServerPlatformFile.

◆ SetAsyncMinimumPriority()

virtual void IPlatformFile::SetAsyncMinimumPriority ( EAsyncIOPriorityAndFlags  MinPriority)
inlinevirtual

Controls if the pak precacher should process precache requests. Requests below this threshold will not get precached. Without this throttle, quite a lot of memory can be consumed if the disk races ahead of the CPU.

Parameters
MinPrioritythe minimum priority at which requests will get precached

Reimplemented in FCachedReadPlatformFile, FLoggedPlatformFile, FPakPlatformFile, and FSandboxPlatformFile.

◆ SetCreatePublicFiles()

virtual void IPlatformFile::SetCreatePublicFiles ( bool  bCreatePublicFiles)
inlinevirtual

Sets file system to create publicly accessible files or not

Parameters
bCreatePublicFilestrue to set the file system to create publicly accessible files

Reimplemented in FIOSPlatformFile.

◆ SetLowerLevel()

virtual void IPlatformFile::SetLowerLevel ( IPlatformFile NewLowerLevel)
pure virtual

◆ SetMarkOfTheWeb()

virtual bool IPlatformFile::SetMarkOfTheWeb ( FStringView  Filename,
bool  bNewStatus,
const FString *  InSourceURL = nullptr 
)
inlinevirtual

Attempt to change the platform-specific metadata that indicates if the file has been downloaded from a web browser.

Parameters
FilenameThe file to change it's mark of the web status.
bNewStatusNew mark of the web status for the file.
InSourceURLAn optional pointer to a source url that will be applied if new status true.
Returns
true if the file's mark of the web status was successful changed, false otherwise.
Remarks
Only works for files on disk and currently only implemented for Windows.

Reimplemented in FWindowsPlatformFile.

◆ SetReadOnly()

virtual bool IPlatformFile::SetReadOnly ( const TCHAR Filename,
bool  bNewReadOnlyValue 
)
pure virtual

◆ SetSandboxEnabled()

virtual void IPlatformFile::SetSandboxEnabled ( bool  bInEnabled)
inlinevirtual

Set whether the sandbox is enabled or not

Parameters
bInEnabledtrue to enable the sandbox, false to disable it

Reimplemented in FSandboxPlatformFile.

◆ SetTimeStamp()

◆ ShouldBeUsed()

virtual bool IPlatformFile::ShouldBeUsed ( IPlatformFile Inner,
const TCHAR CmdLine 
) const
inlinevirtual

Checks if this platform file should be used even though it was not asked to be. i.e. pak files exist on disk so we should use a pak file

Reimplemented in IPhysicalPlatformFile, FCachedReadPlatformFile, FLoggedPlatformFile, FPlatformFileOpenLog, FNetworkPlatformFile, FPakPlatformFile, FSandboxPlatformFile, FStorageServerPlatformFile, and FStreamingNetworkPlatformFile.

◆ Tick()

virtual void IPlatformFile::Tick ( )
inlinevirtual

Platform file can override this to get a regular tick from the engine

Reimplemented in FNetworkPlatformFile, and FPakPlatformFile.


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