FPakPlatformFile

Platform file wrapper to be able to use pak files.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

IPlatformFile

FPakPlatformFile

References

Module

PakFile

Header

/Engine/Source/Runtime/PakFile/Public/IPlatformFilePak.h

Include

#include "IPlatformFilePak.h"

Syntax

class FPakPlatformFile : public IPlatformFile

Remarks

Platform file wrapper to be able to use pak files.

Constructors

Name Description

Public function

FPakPlatformFile()

Constructor.

Destructors

Name Description

Public function Virtual

~FPakPlatformFile()

Destructor.

Functions

Name Description

Public function Const

bool

 

AnyChunksAvailable()

Returns true if any of the mounted or pending pak files are chunks (filenames starting pakchunkN)

Public function Static

void

 

BroadcastPakChunkSignatureCheckFailure

(
    const FPakChunkSignatureCheckFailed...
)

Broadacast a signature check failure through any registered delegates in a thread safe way.

Public function Static

void

 

BroadcastPakMasterSignatureTableCheckFailure

(
    const FString& InFilename
)

Broadacast a master signature table failure through any registered delegates in a thread safe way.

Public function Static

bool

 

CheckIfPakFilesExist

(
    IPlatformFile* LowLevelFile,
    const TArray< FString >& PakFolder...
)

Checks if pak files exist in any of the known pak file locations.

Public function

FString

 

ConvertToPakRelativePath

(
    const TCHAR* Filename,
    const FPakFile* Pak
)

Converts a filename to a path inside pak file.

Public function

bool

 

FindFileInPakFiles

(
    const TCHAR* Filename,
    TRefCountPtr< FPakFile >* OutP...,
    FPakEntry* OutEntry
)

Finds a file in all available pak files.

Public function Static

bool

 

FindFileInPakFiles

(
    TArray< FPakListEntry >& Paks,
    const TCHAR* Filename,
    nullptr_t OutPakFile,
    FPakEntry* OutEntry
)

Overload needed for deprecation; remove this when removing the version with a FPakFile** OutPakFile

Public function Static

bool

 

FindFileInPakFiles

(
    TArray< FPakListEntry >& Paks,
    const TCHAR* Filename,
    TRefCountPtr< FPakFile >* OutP...,
    FPakEntry* OutEntry
)

Finds a file in the specified pak files.

Public function

bool

 

FindFileInPakFiles

(
    const TCHAR* Filename,
    nullptr_t OutPakFile,
    FPakEntry* OutEntry
)

Overload needed for deprecation; remove this when removing the version with a FPakFile** OutPakFile

Public function

void

 

FindFilesInternal

(
    TArray< FString >& FoundFiles,
    const TCHAR* Directory,
    const TCHAR* FileExtension,
    bool bRecursive
)

Public function Static

FFilenameSec...

 

GetFilenameSecurityDelegate()

Access static delegate for loose file security.

Public function Static

void

 

GetFilenamesFromIostoreByBlockIndex

(
    const FString& InContainerName,
    const TArray< int32 >& InBlockInde...,
    TArray< FString >& OutFileList
)

Returns the RelativePathFromMount Filename for every Filename found in the Iostore Container that relates to the provided block indexes

Public function Static

void

 

GetFilenamesFromIostoreContainer

(
    const FString& InContainerName,
    TArray< FString >& OutFileList
)

Returns the RelativePathFromMount Filename for every file found in the given Iostore Container

Public function

void

 

GetMountedPakFilenames

(
    TArray< FString >& PakFilenames
)

Get a list of all pak files which have been successfully mounted

Public function Static

const TCHAR ...

 

GetMountStartupPaksWildCard()

Get the wild card pattern used to identify paks to load on startup

Public function Const

EChunkLocati...

 

GetPakChunkLocation

(
    int32 InPakchunkIndex
)

Determine location information for a given pakchunk index.

Public function Static

FPakCustomEn...

 

GetPakCustomEncryptionDelegate()

Access static delegate for custom encryption.

Public function Static

void

 

GetPakEncryptionKey

(
    FAES::FAESKey& OutKey,
    const FGuid& InEncryptionKeyGuid
)

Helper function for accessing pak encryption key

Precaching

Public function Static

void

 

GetPakFolders

(
    const TCHAR* CmdLine,
    TArray< FString >& OutPakFolders
)

Gets all pak file locations.

Public function Static

FPakSetIndex...

 

GetPakSetIndexSettingsDelegate()

Access static delegate for setting PakIndex settings.

Public function Static

TSharedPtr< ...

 

GetPakSignatureFile

(
    const TCHAR* InFilename
)

Load a pak signature file.

Public function Static

FPakSigningF...

 

GetPakSigningFailureHandlerData()

Access static delegate for handling a pak signature check failure.

Public function

void

 

GetPrunedFilenamesInChunk

(
    const FString& InPakFilename,
    const TArray< int32 >& InChunkIDs,
    TArray< FString >& OutFileList
)

Get a list of RelativePathFromMount for every file in the given Pak that lives in any of the given chunks.

Public function

void

 

GetPrunedFilenamesInPakFile

(
    const FString& InPakFilename,
    TArray< FString >& OutFileList
)

Gets a list of FullPaths (includes Mount directory) for every File in the given Pak's Pruned DirectoryIndex

Public function Static

const TCHAR ...

 

GetTypeName()

Get the unique name for the pak platform file layer

Public function

void

 

HandleMountCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

void

 

HandlePakCorruptCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

void

 

HandlePakListCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

BEGIN Console commands.

Public function

void

 

HandleReloadPakReadersCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

void

 

HandleUnmountCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

IterateDirectoryInternal

(
    const TCHAR* Directory,
    TUniqueFunction< bool...,
    bool bRecursive,
    TSet< FString >& FilesVisitedInPak
)

Public function

bool

 

IterateDirectoryInternal

(
    const TCHAR* Directory,
    IPlatformFile::FDirectoryVisitor& ...,
    bool bRecursive
)

Public function

bool

 

IterateDirectoryStatInternal

(
    const TCHAR* Directory,
    IPlatformFile::FDirectoryStatVisito...,
    bool bRecursive
)

Public function

bool

 

Mount

(
    const TCHAR* InPakFilename,
    uint32 PakOrder,
    const TCHAR* InPath,
    bool bLoadIndex
)

Mounts a pak file at the specified path.

Public function

int32

 

MountAllPakFiles

(
    const TArray< FString >& PakFolder...
)

Public function

int32

 

MountAllPakFiles

(
    const TArray< FString >& PakFolder...,
    const FString& WildCard
)

Public function

void

 

OptimizeMemoryUsageForMountedPaks()

Public function

void

 

ReleaseOldReaders()

Public function

bool

 

ReloadPakReaders()

Re-creates all the pak readers

Public function Static

void

 

RemoveCachedPakSignaturesFile

(
    const TCHAR* InFilename
)

Remove the intenrally cached pointer to the signature file for the specified pak

Public function Static

void

 

SetMountStartupPaksWildCard

(
    const FString& WildCard
)

Overrides the wildcard used for searching paks. Call before initialization

Public function

bool

 

Unmount

(
    const TCHAR* InPakFilename
)

Overridden from IPlatformFile

Name Description

Public function Virtual

FString

 

ConvertToAbsolutePathForExternalAppForRead

(
    const TCHAR* Filename
)

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

Public function Virtual

FString

 

ConvertToAbsolutePathForExternalAppForWrite

(
    const TCHAR* Filename
)

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

Public function Virtual

bool

 

CopyFile

(
    const TCHAR* To,
    const TCHAR* From,
    EPlatformFileRead ReadFlags,
    EPlatformFileWrite WriteFlags
)

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

Public function Virtual

bool

 

CreateDirectory

(
    const TCHAR* Directory
)

Create a directory and return true if the directory was created or already existed.

Public function Virtual

bool

 

CreateDirectoryTree

(
    const TCHAR* Directory
)

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

Public function Virtual

bool

 

DeleteDirectory

(
    const TCHAR* Directory
)

Delete a directory and return true if the directory was deleted or otherwise does not exist.

Public function Virtual

bool

 

DeleteDirectoryRecursively

(
    const TCHAR* Directory
)

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

Public function Virtual

bool

 

DeleteFile

(
    const TCHAR* Filename
)

Delete a file and return true if the file exists. Will not delete read only files.

Public function Virtual

bool

 

DirectoryExists

(
    const TCHAR* Directory
)

Return true if the directory exists.

Public function Virtual

bool

 

FileExists

(
    const TCHAR* Filename
)

Return true if the file exists.

Public function Virtual

int64

 

FileSize

(
    const TCHAR* Filename
)

Return the size of the file, or -1 if it doesn't exist.

Public function Virtual

void

 

FindFiles

(
    TArray< FString >& FoundFiles,
    const TCHAR* Directory,
    const TCHAR* FileExtension
)

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

Public function Virtual

void

 

FindFilesRecursively

(
    TArray< FString >& FoundFiles,
    const TCHAR* Directory,
    const TCHAR* FileExtension
)

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

Public function Virtual

FDateTime

 

GetAccessTimeStamp

(
    const TCHAR* Filename
)

Return the last access time of a file.

Public function Virtual

FString

 

GetFilenameOnDisk

(
    const TCHAR* Filename
)

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

Public function Virtual

IPlatformFil...

 

GetLowerLevel()

Gets the platform file wrapped by this file.

Public function Virtual Const

const TCHAR ...

 

GetName()

Gets this platform file type name.

Public function Virtual

FFileStatDat...

 

GetStatData

(
    const TCHAR* FilenameOrDirecto...
)

Return the stat data for the given file or directory.

Public function Virtual

FDateTime

 

GetTimeStamp

(
    const TCHAR* Filename
)

Return the modification time of a file.

Public function Virtual

void

 

GetTimeStampPair

(
    const TCHAR* FilenameA,
    const TCHAR* FilenameB,
    FDateTime& OutTimeStampA,
    FDateTime& OutTimeStampB
)

Public function Virtual

bool

 

Initialize

(
    IPlatformFile* Inner,
    const TCHAR* CmdLine
)

Initializes platform file.

Public function Virtual

void

 

InitializeNewAsyncIO()

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

Public function Virtual

bool

 

IsReadOnly

(
    const TCHAR* Filename
)

Return true if the file is read only.

Public function Virtual

bool

 

IterateDirectory

(
    const TCHAR* Directory,
    IPlatformFile::FDirectoryVisitor& ...
)

Call the Visit function of the visitor once for each file or directory in a single directory.

Public function Virtual

bool

 

IterateDirectoryRecursively

(
    const TCHAR* Directory,
    IPlatformFile::FDirectoryVisitor& ...
)

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

Public function Virtual

bool

 

IterateDirectoryStat

(
    const TCHAR* Directory,
    IPlatformFile::FDirectoryStatVisito...
)

Call the Visit function of the visitor once for each file or directory in a single directory.

Public function Virtual

bool

 

IterateDirectoryStatRecursively

(
    const TCHAR* Directory,
    IPlatformFile::FDirectoryStatVisito...
)

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

Public function Virtual

void

 

MakeUniquePakFilesForTheseFiles

(
    const TArray< TArray< FString >>& ...
)

Make unique in memory pak files from a list of named files

Public function Virtual

bool

 

MoveFile

(
    const TCHAR* To,
    const TCHAR* From
)

Attempt to move a file. Return true if successful. Will not overwrite existing files.

Public function Virtual

IAsyncReadFi...

 

OpenAsyncRead

(
    const TCHAR* Filename
)

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

Public function Virtual

IMappedFileH...

 

OpenMapped

(
    const TCHAR* Filename
)

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

Public function Virtual

IFileHandle ...

 

OpenRead

(
    const TCHAR* Filename,
    bool bAllowWrite
)

Attempt to open a file for reading.

Public function Virtual

IFileHandle ...

 

OpenWrite

(
    const TCHAR* Filename,
    bool bAppend,
    bool bAllowRead
)

Attempt to open a file for writing.

Public function Virtual

void

 

SetAsyncMinimumPriority

(
    EAsyncIOPriorityAndFlags MinPriorit...
)

Controls if the pak precacher should process precache requests.

Public function Virtual

void

 

SetLowerLevel

(
    IPlatformFile* NewLowerLevel
)

Sets the platform file wrapped by this file.

Public function Virtual

bool

 

SetReadOnly

(
    const TCHAR* Filename,
    bool bNewReadOnlyValue
)

Attempt to change the read only status of a file. Return true if successful.

Public function Virtual

void

 

SetTimeStamp

(
    const TCHAR* Filename,
    FDateTime DateTime
)

Sets the modification time of a file

Public function Virtual Const

bool

 

ShouldBeUsed

(
    IPlatformFile* Inner,
    const TCHAR* CmdLine
)

Checks if this platform file should be used even though it was not asked to be.

Public function Virtual

void

 

Tick()

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

Classes

Name

Description

Public struct

FPakSigningFailureHandlerData

Public class

FPreventDuplicatesStatVisitor

Public class

FPreventDuplicatesVisitor

Public class

FPreventDuplicatesVisitorBase

Helper class to filter out files which have already been visited in one of the pak files.

Constants

Name

Description

PakSignatureFileCache

Internal cache of pak signature files.

PakSignatureFileCacheLock

Deprecated Functions

Name Description

Public function Static

bool

 

FindFileInPakFiles

(
    TArray< FPakListEntry >& Paks,
    const TCHAR* Filename,
    FPakFile** OutPakFile,
    FPakEntry* OutEntry
)

Use version with OutPakFile is a TRefCountPtr instead

Public function

bool

 

FindFileInPakFiles

(
    const TCHAR* Filename,
    FPakFile** OutPakFile,
    FPakEntry* OutEntry
)

Use version with OutPakFile is a TRefCountPtr instead

Public function

void

 

GetFilenamesInChunk

(
    const FString& InPakFilename,
    const TArray< int32 >& InChunkIDs,
    TArray< FString >& OutFileList
)

Use GetPrunedFilenamesInChunk

Public function

void

 

GetFilenamesInPakFile

(
    const FString& InPakFilename,
    TArray< FString >& OutFileList
)

Use GetPrunedFilenamesInPakFile

Public function Static

FPakChunkSig...

 

GetPakChunkSignatureCheckFailedHandler()

GetPakChunkSignatureCheckFailedHandler is not thread safe, so please migrate to using GetPakSigningFailureHandlerData and locking the critical section around any use of the delegates

Public function Static

FPakMasterSi...

 

GetPakMasterSignatureTableCheckFailureHandler()

GetPakMasterSignatureTableCheckFailureHandler is not thread safe, so please migrate to using GetPakSigningFailureHandlerData and locking the critical section around any use of the delegates