FPakFile

Pak file.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

PakFile

Header

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

Include

#include "IPlatformFilePak.h"

Syntax

class FPakFile :
    private FNoncopyable,
    public FRefCountBase,
    public IPakFile

Remarks

Pak file.

Constructors

Name Description

Public function

FPakFile

(
    FArchive* Archive
)

Creates a pak file using the supplied archive.

Public function

FPakFile

(
    IPlatformFile* LowerLevel,
    const TCHAR* Filename,
    bool bIsSigned,
    bool bLoadIndex
)

Creates a pak file using the supplied file handle.

Destructors

No destructors are accessible with public or protected access.

Functions

Name Description

Public function

bool

 

Check()

Checks the validity of the pak data by reading out the data for every file in the pak

Public function Const

bool

 

DirectoryExistsInPruned

(
    const TCHAR* InPath
)

Checks if a directory exists in pak file.

Public function Static

void

 

EncodePakEntriesIntoIndex

(
    int32 InNumEntries,
    const ReadNextEntryFunction& InRea...,
    const TCHAR* InPakFilename,
    const FPakInfo& InPakInfo,
    const FString& MountPoint,
    int32& OutNumEncodedEntries,
    int32& OutNumDeletedEntries,
    uint64* OutPathHashSeed,
    FDirectoryIndex* OutDirectoryI...,
    FPathHashIndex* OutPathHashInd...,
    TArray< uint8 >& OutEncodedPakEntr...,
    TArray< FPakEntry >& OutNonEncodab...,
    TMap< uint64, FString >* InOut...,
    int32 PakFileVersion
)

Public function Const

EFindResult

 

Find

(
    const FString& FullPath,
    FPakEntry* OutEntry
)

Public function Static

const FPakEn...

 

FindLocationFromIndex

(
    const FString& FullPath,
    const FString& MountPoint,
    const FPathHashIndex& PathHashInde...,
    uint64 PathHashSeed,
    int32 PakFileVersion
)

Lookup the FPakEntryLocation stored in the given PathHashIndex, return nullptr if not found

Public function Static

const FPakEn...

 

FindLocationFromIndex

(
    const FString& FullPath,
    const FString& MountPoint,
    const FDirectoryIndex& DirectoryIn...
)

Lookup the FPakEntryLocation stored in the given DirectoryIndex, return nullptr if not found

Public function Const

const FPakDi...

 

FindPrunedDirectory

(
    const TCHAR* InPath
)

Public function Const

void

 

FindPrunedFilesAtPath

(
    ContainerType& OutFiles,
    const TCHAR* InPath,
    bool bIncludeFiles,
    bool bIncludeDirectories,
    bool bRecursive
)

Looks for files or directories within the Pruned DirectoryIndex of the pak file.

Public function

int32

 

GetCacheIndex()

Public function

ECacheType

 

GetCacheType()

Public function Const

const FStrin...

 

GetFilename()

Gets pak filename.

Public function Const

FName

 

GetFilenameName()

Public function Const

const FPakIn...

 

GetInfo()

Gets this pak file info.

Public function Const

bool

 

GetIsMounted()

Public function Const

const FStrin...

 

GetMountPoint()

Gets pak file mount point.

Public function Static

EFindResult

 

GetPakEntry

(
    const FPakEntryLocation& FPakEntry...,
    FPakEntry* OutEntry,
    const TArray< uint8 >& EncodedPakE...,
    const TArray< FPakEntry >& Files,
    const FPakInfo& Info
)

Returns the FPakEntry pointed to by the given FPakEntryLocation inside the given EncodedPakEntries or Files Can return Found or Deleted; if the FPakEntryLocation is invalid this function assumes the FPakEntry exists in this pack but as a deleted file If OutEntry is non-null, populates it with a copy of the FPakEntry found, or sets it to an FPakEntry with SetDeleteRecord(true) if not found

Public function Const

void

 

GetPrunedFilenames

(
    TArray< FString >& OutFileList
)

Returns the FullPath (includes Mount) Filename found in Pruned DirectoryIndex

Public function Const

void

 

GetPrunedFilenamesInChunk

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

Returns the RelativePathFromMount Filename for every Filename found in the Pruned DirectoryIndex that points to a PakEntry in the given Chunk

Public function Static

const TCHAR ...

 

GetRelativeFilePathFromMountPointer

(
    const FString& Child,
    const FString& MountPoint
)

Helper function to return Filename's relative path from the mount point.

Public function Static

bool

 

GetRelativePathFromMountInline

(
    FString& Child,
    const FString& MountPoint
)

Helper function to return Child's relative path from the mount point.

Public function

FSharedPakRe...

 

GetSharedReader

(
    IPlatformFile* LowerLevel
)

Gets shared pak file archive for given thread.

Public function Const

const FDateT...

 

GetTimestamp()

Gets this pak file's tiemstamp.

Public function

bool

 

GetUnderlyingCacheTrimDisabled()

Public function Const

bool

 

HasFilenames()

Returns whether filenames currently exist in the DirectoryIndex for all files in the Pak.

Public function Static

uint64

 

HashPath

(
    const TCHAR* RelativePathFromM...,
    uint64 Seed,
    int32 PakFileVersion
)

Hash the given full-path filename using the hash function used by FPakFiles, with the given FPakFile-specific seed, with version provided for legacy pak files that used different hash function

Public function Static

bool

 

IsPakKeepFullDirectory()

Returns the global,const flag for whether the current process is allowing PakFiles to keep their entire DirectoryIndex (if it exists in the PakFile on disk) rather than pruning it

Public function Static

bool

 

IsPakWriteFullDirectoryIndex()

Returns the global,const flag for whether UnrealPak should write a copy of the full DirectoryIndex to the PakFile

Public function Static

bool

 

IsPakWritePathHashIndex()

Returns the global,const flag for whether UnrealPak should write a copy of the full PathHashIndex and Pruned DirectoryIndex to the PakFile

Public function Static

bool

 

IsPathInDirectoryFormat

(
    const FString& Path
)

Helper function to check that the given string is in our directory format (ends with '/')

Public function Const

bool

 

IsValid()

Checks if the pak file is valid.

Public function Static

void

 

MakeDirectoryFromPath

(
    FString& Path
)

Helper function to modify the given string to append '/' at the end of path to normalize directory names for hash and string compares

Public function Static

FString

 

PakPathCombine

(
    const FString& Parent,
    const FString& Child
)

Helper function to join two path strings that are in the PakPath format

Public function Const

bool

 

PassedSignatureChecks()

Checks if the pak has valid chunk signature checking data, and that the data passed the initial signing check

Public function Static

void

 

PruneDirectoryIndex

(
    FDirectoryIndex& InOutDirectoryInd...,
    FDirectoryIndex* PrunedDirecto...,
    const FString& MountPoint
)

Given a directory index, remove entries from it that are directed by ini to not have filenames kept at runtime.

Public function

void

 

ReadHashFromPayload

(
    const FPakEntry& PakEntry,
    uint8* OutBuffer
)

FPakFile helper functions shared between the runtime and UnrealPak.exe.

Public function

bool

 

RecreatePakReaders

(
    IPlatformFile* LowerLevel
)

Recreates the pak reader for each thread

Public function

void

 

ReleaseOldReaders

(
    double MaxAgeSeconds
)

Delete all readers that haven't been used in MaxAgeSeconds.

Public function

void

 

ReturnSharedReader

(
    FArchive* SharedReader
)

Return a shared pak reader. Should only be called from the FSharedPakReader's destructor.

Public function

void

 

SetCacheIndex

(
    int32 InCacheIndex
)

Public function

void

 

SetCacheType

(
    ECacheType InCacheType
)

Public function

void

 

SetIsMounted

(
    bool bInIsMounted
)

Public function

void

 

SetMountPoint

(
    const TCHAR* Path
)

Sets the pak file mount point.

Public function

void

 

SetUnderlyingCacheTrimDisabled

(
    bool InUnderlyingCacheTrimDisabled
)

Public function Static

bool

 

SplitPathInline

(
    FString& InOutPath,
    FString& OutFilename
)

Helper function to split a PakDirectoryIndex-Formatted PathName into its PakDirectoryIndex-Formatted parent directory and the CleanFileName

Public function Const

int64

 

TotalSize()

Overridden from IPakFile

Name Description

Public function Virtual Const

int32

 

GetNumFiles()

Gets the number of files in this pak.

Public function Virtual Const

bool

 

PakContains

(
    const FString& Filename
)

Return whether the Pak has an entry for the given FileName.

Public function Virtual Const

const FStrin...

 

PakGetMountPoint()

Public function Virtual Const

int32

 

PakGetPakchunkIndex()

Public function Virtual Const

const FStrin...

 

PakGetPakFilename()

IPakFile interface, for users of PakFiles that cannot have a dependency on this header.

Public function Virtual Const

void

 

PakVisitPrunedFilenames

Calls the given Visitor on every FileName in the Pruned Directory Index.

Classes

Name

Description

Public struct

FArchiveAndLastAccessTime

Public class

FBaseIterator

Base functionality for iterating over the DirectoryIndex.

Public class

FFileIterator

Public class

FFilenameIterator

Iterator class used to iterate over just the files in the pak for which we have filenames.

Public struct

FIndexSettings

Public class

FPakEntryIterator

Iterator class for every FPakEntry in the FPakFile, but does not provide filenames unless the PakFile has an unpruned DirectoryIndex.

Public struct

FScopedPakDirectoryIndexAccess

A ReadLock wrapper that must be used to prevent threading errors around any call to FindPrunedDirectory or internal uses of DirectoryIndex

Enums

Name

Description

Public enum

ECacheType

Pak files can share a cache or have their own

Public enum

EFindResult

Finds an entry in the pak file matching the given filename.

Typedefs

Name

Description

FDirectoryIndex

Index data that keeps an in-memory directoryname/filename tree to map a Filename to an FPakEntryLocation

FPathHashIndex

Index data that provides a map from the hash of a Filename to an FPakEntryLocation

ReadNextEntryFunction

Read a list of (Filename, FPakEntry) pairs from a provided enumeration, attempt to encode each one, store each one in the appropriate given encoded and/or unencoded array, and populate the given Directories to map each filename to the location for the FPakEntry

Constants

Name

Description

bSomePakNeedsPruning

Global flag for whether a Pak has indicated it needs Pruning

Deprecated Functions

Name Description

Public function Const

bool

 

DirectoryExists

(
    const TCHAR* InPath
)

Use DirectoryExistsInPruned instead.

Public function Const

const FPakDi...

 

FindDirectory

(
    const TCHAR* InPath
)

Use FindPrunedDirectory instead and wrap the access with FScopedPakDirectoryIndexAccess; const FPakDirectory is no longer threadsafe.

Public function Const

void

 

FindFilesAtPath

(
    ContainerType& OutFiles,
    const TCHAR* InPath,
    bool bIncludeFiles,
    bool bIncludeDirectories,
    bool bRecursive
)

Use FindPrunedFilesAtPath instead

Public function Const

void

 

GetFilenames

(
    TArray< FString >& OutFileList
)

Use GetPrunedFilenames instead

Public function Const

void

 

GetFilenamesInChunk

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

Use GetPrunedFilenamesInChunk instead

Public function Const

const TMap< ...

 

GetIndex()

Use FPrunedFilenameIterator or FPakEntryIterator instead; the Index is now no longer necessarily a DirectoryIndex and in some cases requires a lock around Index use