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

#include <PackagePath.h>

Public Member Functions

constexpr FPackagePath ()=default
 
COREUOBJECT_API FPackagePath (const FPackagePath &Other)
 
 FPackagePath (FPackagePath &&Other)=default
 
COREUOBJECT_API FPackagePathoperator= (const FPackagePath &Other)
 
FPackagePathoperator= (FPackagePath &&Other)=default
 
COREUOBJECT_API void Empty ()
 
COREUOBJECT_API bool operator== (const FPackagePath &Other) const
 
COREUOBJECT_API bool operator!= (const FPackagePath &Other) const
 
COREUOBJECT_API bool IsEmpty () const
 
COREUOBJECT_API bool IsMountedPath () const
 
COREUOBJECT_API bool HasPackageName () const
 
COREUOBJECT_API bool HasLocalPath () const
 
COREUOBJECT_API FString GetPackageName () const
 
COREUOBJECT_API void AppendPackageName (FStringBuilderBase &Builder) const
 
COREUOBJECT_API FName GetPackageFName () const
 
COREUOBJECT_API FString GetLocalFullPath () const
 
COREUOBJECT_API void AppendLocalFullPath (FStringBuilderBase &Builder) const
 
COREUOBJECT_API FString GetLocalBaseFilenameWithPath () const
 
COREUOBJECT_API void AppendLocalBaseFilenameWithPath (FStringBuilderBase &Builder) const
 
COREUOBJECT_API EPackageExtension GetHeaderExtension () const
 
COREUOBJECT_API FString GetDebugName () const
 
COREUOBJECT_API FText GetDebugNameText () const
 
COREUOBJECT_API FString GetDebugNameWithExtension () const
 
COREUOBJECT_API FString GetPackageNameOrFallback () const
 
COREUOBJECT_API void SetHeaderExtension (EPackageExtension Extension, FStringView CustomExtension=FStringView()) const
 
COREUOBJECT_API FStringView GetCustomExtension () const
 
COREUOBJECT_API EPackageExtension GetExtension (EPackageSegment PackageSegment, FStringView &OutCustomExtension) const
 
COREUOBJECT_API FStringView GetExtensionString (EPackageSegment PackageSegment) const
 
COREUOBJECT_API TConstArrayView< EPackageExtensionGetPossibleExtensions (EPackageSegment PackageSegment) const
 
COREUOBJECT_API FString GetLocalFullPath (EPackageSegment PackageSegment) const
 
COREUOBJECT_API void AppendLocalFullPath (FStringBuilderBase &Builder, EPackageSegment PackageSegment) const
 
COREUOBJECT_API FString GetDebugName (EPackageSegment PackageSegment) const
 
COREUOBJECT_API FText GetDebugNameText (EPackageSegment PackageSegment) const
 
COREUOBJECT_API FString GetDebugNameWithExtension (EPackageSegment PackageSegment) const
 

Static Public Member Functions

static COREUOBJECT_API bool TryFromMountedName (FStringView InPackageNameOrHeaderFilePath, FPackagePath &OutPackagePath)
 
static COREUOBJECT_API bool TryFromPackageName (FStringView InPackageName, FPackagePath &OutPackagePath)
 
static COREUOBJECT_API bool TryFromPackageName (FName InPackageName, FPackagePath &OutPackagePath)
 
static COREUOBJECT_API bool TryFromPackageName (const TCHAR *InPackageName, FPackagePath &OutPackagePath)
 
static COREUOBJECT_API FPackagePath FromPackageNameChecked (FStringView InPackageName)
 
static COREUOBJECT_API FPackagePath FromPackageNameChecked (FName InPackageName)
 
static COREUOBJECT_API FPackagePath FromPackageNameChecked (const TCHAR *InPackageName)
 
static COREUOBJECT_API FPackagePath FromPackageNameUnchecked (FName InPackageName)
 
static COREUOBJECT_API FPackagePath FromLocalPath (FStringView InFilename)
 
static COREUOBJECT_API FPackagePath FromMountedComponents (FStringView PackageNameRoot, FStringView FilePathRoot, FStringView RelPath, EPackageExtension InExtension, FStringView InCustomExtension=FStringView())
 
static COREUOBJECT_API bool TryMatchCase (const FPackagePath &SourcePackagePath, FStringView FilePathToMatch, FPackagePath &OutPackagePath)
 
static COREUOBJECT_API EPackageExtension ParseExtension (FStringView Filename, int32 *OutExtensionStart=nullptr)
 
static COREUOBJECT_API const TCHARGetOptionalSegmentExtensionModifier ()
 
static COREUOBJECT_API const TCHARGetExternalActorsFolderName ()
 
static COREUOBJECT_API const TCHARGetExternalObjectsFolderName ()
 
static COREUOBJECT_API FPackagePath FromLocalPath (FStringView InFilename, EPackageSegment &OutPackageSegment)
 

Friends

COREUOBJECT_API FArchiveoperator<< (FArchive &Ar, FPackagePath &PackagePath)
 

Detailed Description

Internal class only; not used by blueprints. This class is only used in the CoreUObject linker layer and (optionally) as an argument to LoadPackage

Specifies a path to the contents of a UPackage that can be loaded from disk (or other persistent storage) through IPackageResourceManager Package contents are requested from the PackageResourceManager by FPackagePath and EPackageSegment FPackagePaths are stored internally in one of a few options necessary to maintain their construction arguments without losing data const FPackagePaths can still be mutated to be stored as another internal type const FPackagePaths can still be mutated to indicate which header extension was found for them on disk (It is illegal to have multiple packages on disk with the same PackagePath but different header extensions)

Constructor & Destructor Documentation

◆ FPackagePath() [1/3]

constexpr FPackagePath::FPackagePath ( )
constexprdefault

Construct an empty PackagePath

◆ FPackagePath() [2/3]

FPackagePath::FPackagePath ( const FPackagePath Other)

◆ FPackagePath() [3/3]

FPackagePath::FPackagePath ( FPackagePath &&  Other)
default

Member Function Documentation

◆ AppendLocalBaseFilenameWithPath()

COREUOBJECT_API void FPackagePath::AppendLocalBaseFilenameWithPath ( FStringBuilderBase Builder) const

Append the Local (path,basename) of this PackagePath if known or available, or take no action if not

Appending is possible only for MountedPath and LocalOnly internal types. Will attempt to mount before returning with no action

◆ AppendLocalFullPath() [1/2]

COREUOBJECT_API void FPackagePath::AppendLocalFullPath ( FStringBuilderBase Builder) const

Append the full relative LocalPath (path,basename,extension)

The path is in the standard UnrealEngine form - it is as a relative path from the process binary directory Extension is set based on the given segment If the LocalPath for this PackagePath is unknown, nothing is written to the Builder Appending is possible only for MountedPath and LocalOnly internal types. Will attempt to mount before returning with no action

◆ AppendLocalFullPath() [2/2]

COREUOBJECT_API void FPackagePath::AppendLocalFullPath ( FStringBuilderBase Builder,
EPackageSegment  PackageSegment 
) const

Version of AppendLocalFullPath that takes a PackageSegment, otherwise same behavior as parameterless version

◆ AppendPackageName()

void FPackagePath::AppendPackageName ( FStringBuilderBase Builder) const

Append the PackageName indicated by this PackagePath if known or available, or take no action if not

Appending is possible only for MountedPath and PackageOnly internal types. Will attempt to mount before returning with no action

◆ Empty()

void FPackagePath::Empty ( )

Free this PackagePath's data and set it to an empty PackagePath

◆ FromLocalPath() [1/2]

FPackagePath FPackagePath::FromLocalPath ( FStringView  InFilename)
static

Construct a PackagePath from a LocalPath string

Does not handle InFilenames that are actually PackageNames; use TryFromMountedName if you need to handle either PackageName or LocalPath Will be converted to a MountedPath when the PackageName is required; if the package is not mounted at that point the PackageName will be empty. Always succeeds; all strings are valid filenames

Parameters
InFilenameThe full LocalPath, D:\Folder\File.Ext, may be relative or absolute, extension is not required
Returns
The constructed PackagePath

◆ FromLocalPath() [2/2]

FPackagePath FPackagePath::FromLocalPath ( FStringView  InFilename,
EPackageSegment OutPackageSegment 
)
static

Version of FromLocalPath that also returns the PackageSegment matching the Filename's extension

◆ FromMountedComponents()

FPackagePath FPackagePath::FromMountedComponents ( FStringView  PackageNameRoot,
FStringView  FilePathRoot,
FStringView  RelPath,
EPackageExtension  InExtension,
FStringView  InCustomExtension = FStringView() 
)
static

Construct a PackagePath from the components of a MountedPath

This function is less expensive than TryFromMountedName It is invalid to call this function with arguments that do not match an existing directory that is mounted (aka registered with FPackageName::MountPointExists)

Parameters
PackageNameRootThe PackageName of the MountPoint
FilePathRootThe FilePath of the MountPoint
RelPathThe relative path of the PackagePath from the PackageNameRoot/FilePathRoot (relative path from MountPoint is the same in PackageNames and LocalPaths)
InExtensionThe header extension to give the PackagePath. Extensions that are not header extensions are ignored
InCustomExtensionThe custom string to use if InExtension is EPackageExtension::Custom
Returns
The constructed PackagePath

◆ FromPackageNameChecked() [1/3]

FPackagePath FPackagePath::FromPackageNameChecked ( const TCHAR InPackageName)
static

◆ FromPackageNameChecked() [2/3]

FPackagePath FPackagePath::FromPackageNameChecked ( FName  InPackageName)
static

◆ FromPackageNameChecked() [3/3]

FPackagePath FPackagePath::FromPackageNameChecked ( FStringView  InPackageName)
static

Construct a PackagePath from a LongPackageName StringView, FName, or TCHAR*

Does not handle InPackageNames that are actually LocalPaths; use TryFromMountedName if you need to handle either PackageName or LocalPath Gives an error and returns an empty PackagePath if InPackageName is not a valid LongPackageName (/Root/Folder/File) Will be converted to a MountedPath when the LocalPath is required; if the package is not mounted at that point the LocalPath will be empty

Parameters
InPackageNameA valid LongPackageName, does not have to be mounted or existing
Returns
The constructed PackagePath

◆ FromPackageNameUnchecked()

FPackagePath FPackagePath::FromPackageNameUnchecked ( FName  InPackageName)
static

Construct a PackagePath from a known valid LongPackageName FName

Will be converted to a MountedPath when the LocalPath is required; if the package is not mounted at that point the LocalPath will be empty

Parameters
InPackageNameA valid LongPackageName, does not have to be mounted or existing
Returns
The constructed PackagePath

◆ GetCustomExtension()

FStringView FPackagePath::GetCustomExtension ( ) const

Return the custom string if this PackagePath is using HeaderExtension=EPackageExtension::Custom, otherwise return an empty string

◆ GetDebugName() [1/2]

FString FPackagePath::GetDebugName ( ) const

Returns a descriptor of this PackagePath, usable for an identifier in warning and log messages. Extension is not indicated.

◆ GetDebugName() [2/2]

FString FPackagePath::GetDebugName ( EPackageSegment  PackageSegment) const

Version of GetDebugName that takes a PackageSegment, otherwise same behavior as parameterless version For EPackageSegment::Header, HeaderExtension is not indicated. For all other segments, segment is identified by extension

◆ GetDebugNameText() [1/2]

FText FPackagePath::GetDebugNameText ( ) const

Returns GetDebugName converted to FText

◆ GetDebugNameText() [2/2]

FText FPackagePath::GetDebugNameText ( EPackageSegment  PackageSegment) const

Version of GetDebugNameText that takes a PackageSegment, otherwise same behavior as parameterless version

◆ GetDebugNameWithExtension() [1/2]

FString FPackagePath::GetDebugNameWithExtension ( ) const

Returns a descriptor of this PackagePath for the given segment, with extension.

◆ GetDebugNameWithExtension() [2/2]

FString FPackagePath::GetDebugNameWithExtension ( EPackageSegment  PackageSegment) const

Version of GetDebugNameWithExtension that takes a PackageSegment, otherwise same behavior as parameterless version

◆ GetExtension()

EPackageExtension FPackagePath::GetExtension ( EPackageSegment  PackageSegment,
FStringView OutCustomExtension 
) const

Report the extension this PackagePath uses for the given segment

Parameters
PackageSegmentThe segment of the extension to look up
OutCustomExtensionIf the segment is EPackageSegment::Header and this PackagePath has a custom header extension, filled with the Custom string, otherwise set to empty. CustomExtension can become invalid the next time a function (even a const function) or the destructor is called on this FPackagePath
Returns
the EPackageExtension for the given segment, which is possibly EPackageExtension::Unspecified or EPackageExtension::Custom for EPackageSegment::Header

◆ GetExtensionString()

FStringView FPackagePath::GetExtensionString ( EPackageSegment  PackageSegment) const

Report the extension string this PackagePath uses for the given segment.

Parameters
PackageSegmentThe segment of the extension to look up
Returns
the string for the given segment, which is possibly the empty string or a custom string for EPackageSegment::Header

◆ GetExternalActorsFolderName()

const TCHAR * FPackagePath::GetExternalActorsFolderName ( )
static

Get the folder name from which all external actors paths are created

Returns
folder name

◆ GetExternalObjectsFolderName()

const TCHAR * FPackagePath::GetExternalObjectsFolderName ( )
static

Get the folder name from which all external objects paths are created

Returns
folder name

◆ GetHeaderExtension()

EPackageExtension FPackagePath::GetHeaderExtension ( ) const

Return the HeaderExtension

The header extension is the extension the header segment of this PackagePath has on disk. It is illegal to have multiple files on disk with the same BaseNameWithPath but different header extensions, so the header extension is optional. If unspecified, all header extensions will be searched. If specified, it is assumed correct and searches will return false if they have a different header extension. The header extension is a performance hint and matching header extensions is not required for equality. The header extension will be mutated even on const FPackagePaths when it is not already set and functions are called that need to calculate it

◆ GetLocalBaseFilenameWithPath()

FString FPackagePath::GetLocalBaseFilenameWithPath ( ) const

Return the Local (path,basename) of this PackagePath if known or available, or empty string if not

Returning non-empty is possible only for MountedPath and LocalOnly internal types. Will attempt to mount before returning empty

◆ GetLocalFullPath() [1/2]

FString FPackagePath::GetLocalFullPath ( ) const

Return the full LocalPath (path,basename,extension)

The path is in the standard UnrealEngine form - it is as a relative path from the process binary directory Extension is set based on the given segment If the LocalPath for this PackagePath is unknown, returns the empty string Returning non-empty is possible only for MountedPath and LocalOnly internal types. Will attempt to mount before returning empty

◆ GetLocalFullPath() [2/2]

FString FPackagePath::GetLocalFullPath ( EPackageSegment  PackageSegment) const

Version of GetLocalFullPath that takes a PackageSegment, otherwise same behavior as parameterless version

◆ GetOptionalSegmentExtensionModifier()

const TCHAR * FPackagePath::GetOptionalSegmentExtensionModifier ( )
static

Get the string identifying optional segments

Returns
the string modifier added prior to the file extension that identify optional segments (i.e. ".o")

◆ GetPackageFName()

FName FPackagePath::GetPackageFName ( ) const

Return as an FName the PackageName indicated by this PackagePath if known or available, or NAME_None if not

Returning a valid name is possible only for MountedPath and PackageOnly internal types. Will attempt to mount before returning NAME_None

◆ GetPackageName()

FString FPackagePath::GetPackageName ( ) const

Return the PackageName indicated by this PackagePath if known or available, or empty string if not

Returning non-empty is possible only for MountedPath and PackageOnly internal types. Will attempt to mount before returning empty

◆ GetPackageNameOrFallback()

FString FPackagePath::GetPackageNameOrFallback ( ) const

Returns the PackageName if available, otherwise the LocalPath

Do not use this function as a PackageName; use it only for uniquely identifying PackagePaths in e.g. a TMap

◆ GetPossibleExtensions()

TConstArrayView< EPackageExtension > FPackagePath::GetPossibleExtensions ( EPackageSegment  PackageSegment) const

Report the EPackageExtensions this PackagePath should look for on disk

The reported array will be length 1 for every case except EPackageSegment::Header and HeaderExtension == EPackageExtension::Unspecified, in that case it will be the list of all enumerated header extensions

Parameters
PackageSegmentThe segment of the extension to look up
Returns
A TArray of EPackageExtensions. If the array contains EPackageExtension::Custom, caller must call GetCustomExtension to get the specific string.

◆ HasLocalPath()

COREUOBJECT_API bool FPackagePath::HasLocalPath ( ) const

Return true if and only if GetLocalBaseFilenameWithPath returns non-empty

Returning true is possible for MountedPath and LocalOnly internal types. Will attempt to mount before returning false

◆ HasPackageName()

COREUOBJECT_API bool FPackagePath::HasPackageName ( ) const

Return true if and only if GetPackageName returns non-empty

Returning true is possible only for MountedPath and PackageOnly internal types. Will attempt to mount before returning false

◆ IsEmpty()

bool FPackagePath::IsEmpty ( ) const

Return whether this is a PackagePath with no path information and can never identify a package on disk

Note that IsEmpty == false does not imply that the package exists on disk, only that the PackagePath is valid

◆ IsMountedPath()

bool FPackagePath::IsMountedPath ( ) const

Return whether a mount point has been found for this PackagePath

Will attempt to mount before returning false

◆ operator!=()

bool FPackagePath::operator!= ( const FPackagePath Other) const

◆ operator=() [1/2]

FPackagePath & FPackagePath::operator= ( const FPackagePath Other)

◆ operator=() [2/2]

FPackagePath & FPackagePath::operator= ( FPackagePath &&  Other)
default

◆ operator==()

bool FPackagePath::operator== ( const FPackagePath Other) const

◆ ParseExtension()

EPackageExtension FPackagePath::ParseExtension ( FStringView  Filename,
int32 OutExtensionStart = nullptr 
)
static

Parse the extension from a filepath and convert it to an EPackageExtension.

Note this is not the same as FPaths::GetExtension because some EPackageExtensions have multiple '.'s (e.g. .m.ubulk)

Parameters
FilenameThe path to parse the extension from
OutExtensionStartIf non-null, will be filled with the index of the '.' at the start of the extension, or with Filename.Len() if no extension is found
Returns
The EPackageExtension matching the (case-insensitive) extension text in the filename. EPackageExtension::Unspecified if the filename has no extension. EPackageExtension::Custom if the filename's extension is not one of the enumerated possibilities in EPackageExtension

◆ SetHeaderExtension()

void FPackagePath::SetHeaderExtension ( EPackageExtension  Extension,
FStringView  CustomExtension = FStringView() 
) const

Set the HeaderExtension to use, including a custom string if Extension is EPackageExtension::Custom

◆ TryFromMountedName()

bool FPackagePath::TryFromMountedName ( FStringView  InPackageNameOrHeaderFilePath,
FPackagePath OutPackagePath 
)
static

Construct a PackagePath from a LocalPath or PackageName string, assuming the given LocalPath or PackageName is in a directory that is mounted (aka registered with FPackageName::MountPointExists)

Parameters
InPackageNameOrHeaderFilePathA string that describes either the PackageName or LocalPath of a PackagePath
OutPackagePathIf the function succeeds, the created PackagePath is assigned to this variable. Otherwise this variable is not written
Returns
True if the input string was found in a mounted path and OutPackagePath has been set, false otherwise

◆ TryFromPackageName() [1/3]

bool FPackagePath::TryFromPackageName ( const TCHAR InPackageName,
FPackagePath OutPackagePath 
)
static

◆ TryFromPackageName() [2/3]

bool FPackagePath::TryFromPackageName ( FName  InPackageName,
FPackagePath OutPackagePath 
)
static

◆ TryFromPackageName() [3/3]

bool FPackagePath::TryFromPackageName ( FStringView  InPackageName,
FPackagePath OutPackagePath 
)
static

Attempt to construct a PackagePath from a LongPackageName StringView, FName, or TCHAR*

Does not handle InPackageNames that are actually LocalPaths; use TryFromMountedName if you need to handle either PackageName or LocalPath Fails and returns false if and only if InPackageName is not a valid LongPackageName (/Root/Folder/File) Will be converted to a MountedPath when the LocalPath is required; if the package is not mounted at that point the LocalPath will be empty

Parameters
InPackageNameThe LongPackageName to test, does not have to be mounted or existing
OutPackagePathIf InPackageName is valid, the constructed PackagePath is copied into this variable, otherwise the variable is not written
Returns
True if InPackageName is valid, else false

◆ TryMatchCase()

bool FPackagePath::TryMatchCase ( const FPackagePath SourcePackagePath,
FStringView  FilePathToMatch,
FPackagePath OutPackagePath 
)
static

Set the capitalization of a PackagePath to match the given string

If the given FilePathToMatch is case-insensitively equal to the LocalPath of the source PackagePath, set the output PackagePath equal to a copy of the source but with capitalization set equal to the capitalization in FilePathToMatch

Parameters
SourcePackagePathThe PackagePath to compare against FilePathToMatch
FilePathToMatchThe LocalPath to compare against SourcePackagePath's LocalPath
OutPackagePathSet to the matching-capitalization copy of SourcePackagePath if FilePathToMatch matched SourcePackagePath case-insensitively
Returns
True if FilePathToMatch matched SourcePackagePath case-insensitively, else false

Friends And Related Symbol Documentation

◆ operator<<

COREUOBJECT_API FArchive & operator<< ( FArchive Ar,
FPackagePath PackagePath 
)
friend

Serialization operator. It is invalid to serialize a PackagePath to persistent data; package path serialization is dependent upon transient data and may change between process invocations


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