FPackageName

Windows
MacOS
Linux

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/Misc/PackageName.h

Include

#include "Misc/PackageName.h"

Syntax

class FPackageName

Functions

Name Description

Public function Static

FString

 

ConvertToLongScriptPackageName

(
    const TCHAR* InShortName
)

Helper function for converting short to long script package name (InputCore -> /Script/InputCore)

Public function Static

bool

 

DoesPackageExist

(
    const FString& LongPackageName,
    const FGuid* Guid,
    FString* OutFilename,
    bool InAllowTextFormats
)

Checks if the package exists on disk.

Public function Static

FDoesPackage...

 

DoesPackageExistOverride()

Public function Static

bool

 

DoesPackageNameContainInvalidCharacters

(
    FStringView InLongPackageName,
    FText* OutReason
)

Checks if a package name contains characters that are invalid for package names.

Public function Static

void

 

EnsureContentPathsAreRegistered()

If the FLongPackagePathsSingleton is not created yet, this function will create it and thus allow mount points to be added

Public function Static

FString

 

ExportTextPathToObjectPath

(
    const TCHAR* InExportTextPath
)

Returns the path to the object referred to by the supplied export text path, excluding the class name.

Public function Static

FString

 

ExportTextPathToObjectPath

(
    const FString& InExportTextPath
)

Returns the path to the object referred to by the supplied export text path, excluding the class name.

Public function Static

FAnsiStringV...

 

ExportTextPathToObjectPath

(
    FAnsiStringView InExportTextPath
)

Returns the path to the object referred to by the supplied export text path, excluding the class name.

Public function Static

FWideStringV...

 

ExportTextPathToObjectPath

(
    FWideStringView InExportTextPath
)

Returns the path to the object referred to by the supplied export text path, excluding the class name.

Public function Static

FString

 

FilenameToLongPackageName

(
    const FString& InFilename
)

Converts the supplied filename to long package name.

Public function Static

bool

 

FindPackageFileWithoutExtension

(
    const FString& InPackageFilename,
    FString& OutFilename,
    bool InAllowTextFormats
)

Checks if a package can be found using known package extensions.

Public function Static

bool

 

FindPackagesInDirectories

(
    TArray< FString >& OutPackages,
    const TArrayView< const FString >&...
)

This will recurse over the given list of directory structures looking for packages.

Public function Static

bool

 

FindPackagesInDirectory

(
    TArray< FString >& OutPackages,
    const FString& RootDir
)

This will recurse over a directory structure looking for packages.

Public function Static

FName *

 

FindScriptPackageName

(
    FName InShortName
)

Finds long script package name associated with a short package name.

Public function Static

bool

 

FixPackageNameCase

(
    FString& LongPackageName,
    FStringView Extension
)

Converts a long package name to the case it exists as on disk.

Public function Static

const FStrin...

 

GetAssetPackageExtension()

Returns the file extension for packages containing assets.

Public function Static

FString

 

GetDelegateResolvedPackagePath

(
    const FString& InSourcePackagePath
)

Gets the resolved path of a long package as determined by the delegates registered with FCoreDelegates::PackageNameResolvers.

Public function Static

FString

 

GetLocalizedPackagePath

(
    const FString& InSourcePackagePath
)

Gets the localized version of a long package path for the current culture, or returns the source package if there is no suitable localized package.

Public function Static

FString

 

GetLocalizedPackagePath

(
    const FString& InSourcePackagePath,
    const FString& InCultureName
)

Gets the localized version of a long package path for the given culture, or returns the source package if there is no suitable localized package.

Public function Static

FString

 

GetLongPackageAssetName

(
    const FString& InLongPackageName
)

Returns the clean asset name for the specified package, same as GetShortName

Public function Static

FString

 

GetLongPackagePath

(
    const FString& InLongPackageName
)

Returns the path to the specified package, excluding the short package name

Public function Static

const FStrin...

 

GetMapPackageExtension()

Returns the file extension for packages containing assets.

Public function Static

FString

 

GetNormalizedObjectPath

(
    const FString& ObjectPath
)

Gets normalized object path i.e. with long package format.

Public function Static

FName

 

GetPackageMountPoint

(
    const FString& InPackagePath,
    bool InWithoutSlashes
)

Get the mount point for a given package path

Public function Static

FName

 

GetShortFName

(
    const FName& LongName
)

Converts package name to short name.

Public function Static

FName

 

GetShortFName

(
    const TCHAR* LongName
)

Converts package name to short name.

Public function Static

FName

 

GetShortFName

(
    const FString& LongName
)

Converts package name to short name.

Public function Static

FString

 

GetShortName

(
    const TCHAR* LongName
)

Converts package name to short name.

Public function Static

FString

 

GetShortName

(
    const FName& LongName
)

Converts package name to short name.

Public function Static

FString

 

GetShortName

(
    const UPackage* Package
)

Converts package name to short name.

Public function Static

FString

 

GetShortName

(
    const FString& LongName
)

Converts package name to short name.

Public function Static

FString

 

GetSourcePackagePath

(
    const FString& InLocalizedPackageP...
)

Gets the source version of a localized long package path (it is also safe to pass non-localized paths into this function).

Public function Static

const FStrin...

 

GetTextAssetPackageExtension()

Returns the file extension for packages containing text assets.

Public function Static

const FStrin...

 

GetTextMapPackageExtension()

Returns the file extension for packages containing text maps.

Public function Static

bool

 

IsAssetPackageExtension

(
    const TCHAR* Ext
)

Returns whether the passed in extension is a valid binary asset package extension.

Public function Static

bool

 

IsExtraPackage

(
    FStringView InPackageName
)

Checks the root of the package's path to see if it's an extra package

Public function Static

bool

 

IsLocalizedPackage

(
    FStringView InPackageName
)

Checks the root of the package's path to see if it is a localized package

Public function Static

bool

 

IsMapPackageExtension

(
    const TCHAR* Ext
)

Returns whether the passed in extension is a valid binary map package extension.

Public function Static

bool

 

IsMemoryPackage

(
    FStringView InPackageName
)

Checks the root of the package's path to see if it's a memory package This should be set for packages that reside in memory and not on disk, we treat them similar to a script package

Public function Static

bool

 

IsPackageExtension

(
    const TCHAR* Ext
)

Returns whether the passed in extension is a valid binary package extension.

Public function Static

bool

 

IsPackageFilename

(
    const FString& Filename
)

Returns whether the passed in filename ends with any of the known package extensions.

Public function Static

bool

 

IsScriptPackage

(
    FStringView InPackageName
)

Checks the root of the package's path to see if it is a script package

Public function Static

bool

 

IsShortPackageName

(
    const FString& PossiblyLongName
)

Checks if the given string is a long package name or not.

Public function Static

bool

 

IsShortPackageName

(
    const FName PossiblyLongName
)

Checks if the given string is a long package name or not.

Public function Static

bool

 

IsShortPackageName

(
    FStringView PossiblyLongName
)

Checks if the given string is a long package name or not.

Public function Static

bool

 

IsTempPackage

(
    FStringView InPackageName
)

Checks the root of the package's path to see if it is a temp package Temp packages are sometimes saved to disk, and sometimes only exist in memory.

Public function Static

bool

 

IsTextAssetPackageExtension

(
    const TCHAR* Ext
)

Returns whether the passed in extension is a valid text asset package extension.

Public function Static

bool

 

IsTextMapPackageExtension

(
    const TCHAR* Ext
)

Returns whether the passed in extension is a valid text map package extension.

Public function Static

bool

 

IsTextPackageExtension

(
    const TCHAR* Ext
)

Returns whether the passed in extension is a valid text package extension.

Public function Static

bool

 

IsValidLongPackageName

(
    const FString& InLongPackageName,
    bool bIncludeReadOnlyRoots,
    FText* OutReason
)

Returns true if the path starts with a valid root (i.e. /Game/, /Engine/, etc) and contains no illegal characters.

Public function Static

bool

 

IsValidObjectPath

(
    const FString& InObjectPath,
    FText* OutReason
)

Returns true if the path starts with a valid root (i.e. /Game/, /Engine/, etc) and contains no illegal characters.

Public function Static

bool

 

IsValidPath

(
    const FString& InPath
)

Returns true if the path starts with a valid root (i.e. /Game/, /Engine/, etc).

Public function Static

void

 

IteratePackagesInDirectory

(
    const FString& RootDir,
    const FPackageNameStatVisitor& Vis...
)

Public function Static

void

 

IteratePackagesInDirectory

(
    const FString& RootDir,
    const FPackageNameVisitor& Visitor
)

Public function Static

FString

 

LongPackageNameToFilename

(
    const FString& InLongPackageName,
    const FString& InExtension
)

Converts a long package name to a file name with the supplied extension.

Public function Static

bool

 

MountPointExists

(
    const FString& RootPath
)

Returns whether the specific logical root path is a valid mount point.

Public function Static

FWideStringV...

 

ObjectPathToObjectName

(
    FWideStringView InObjectPath
)

Returns the name of the object referred to by the specified object path

Public function Static

FAnsiStringV...

 

ObjectPathToObjectName

(
    FAnsiStringView InObjectPath
)

Returns the name of the object referred to by the specified object path

Public function Static

FString

 

ObjectPathToObjectName

(
    const FString& InObjectPath
)

Returns the name of the object referred to by the specified object path

Public function Static

FWideStringV...

 

ObjectPathToPackageName

(
    FWideStringView InObjectPath
)

Returns the name of the package referred to by the specified object path

Public function Static

FAnsiStringV...

 

ObjectPathToPackageName

(
    FAnsiStringView InObjectPath
)

Returns the name of the package referred to by the specified object path

Public function Static

FString

 

ObjectPathToPackageName

(
    const FString& InObjectPath
)

Returns the name of the package referred to by the specified object path

Public function Static

FOnContentPa...

 

OnContentPathDismounted()

Public function Static

FOnContentPa...

 

OnContentPathMounted()

Public function Static

bool

 

ParseExportTextPath

(
    const FString& InExportTextPath,
    FString* OutClassName,
    FString* OutObjectPath
)

Converts the supplied export text path to an object path and class name.

Public function Static

bool

 

ParseExportTextPath

(
    FWideStringView InExportTextPath,
    FWideStringView* OutClassName,
    FWideStringView* OutObjectPath
)

Converts the supplied export text path to an object path and class name.

Public function Static

bool

 

ParseExportTextPath

(
    FAnsiStringView InExportTextPath,
    FAnsiStringView* OutClassName,
    FAnsiStringView* OutObjectPath
)

Converts the supplied export text path to an object path and class name.

Public function Static

bool

 

ParseExportTextPath

(
    const TCHAR* InExportTextPath,
    FStringView* OutClassName,
    FStringView* OutObjectPath
)

Converts the supplied export text path to an object path and class name.

Public function Static

void

 

QueryRootContentPaths

(
    TArray< FString >& OutRootContentP...,
    bool bIncludeReadOnlyRoots,
    bool bWithoutLeadingSlashes,
    bool bWithoutTrailingSlashes
)

Queries all of the root content paths, like "/Game/", "/Engine/", and any dynamically added paths

Public function Static

void

 

RegisterMountPoint

(
    const FString& RootPath,
    const FString& ContentPath
)

This will insert a mount point at the head of the search chain (so it can overlap an existing mount point and win).

Public function Static

void

 

RegisterShortPackageNamesForUObjectModules()

Registers all short package names found in ini files.

Public function Static

bool

 

SearchForPackageOnDisk

(
    const FString& PackageName,
    FString* OutLongPackageName,
    FString* OutFilename
)

Attempts to find a package given its short name on disk (very slow).

Public function Static

void

 

SplitFullObjectPath

(
    const FString& InFullObjectPath,
    FString& OutClassName,
    FString& OutPackageName,
    FString& OutObjectName,
    FString& OutSubObjectName
)

Split a full object path (Class /Path/To/A/Package.Object:SubObject) into its constituent pieces

Public function Static

bool

 

SplitLongPackageName

(
    const FString& InLongPackageName,
    FString& OutPackageRoot,
    FString& OutPackagePath,
    FString& OutPackageName,
    const bool bStripRootLeadingSlash
)

Convert a long package name into root, path, and name components

Public function Static

bool

 

TryConvertFilenameToLongPackageName

(
    const FString& InFilename,
    FString& OutPackageName,
    FString* OutFailureReason
)

Tries to convert the supplied relative or absolute filename to a long package name/path starting with a root like /game This works on both package names and directories, and it does not validate that it actually exists on disk.

Public function Static

bool

 

TryConvertGameRelativePackagePathToLocalPath

(
    FStringView RelativePackagePath,
    FString& OutLocalPath
)

Tries to convert a file or directory in game-relative package name format to the corresponding local path Game-relative package names can be a full package path (/Game/Folder/File, /Engine/Folder/File, /PluginName/Folder/File) or a relative path (Folder/File).

Public function Static

bool

 

TryConvertLongPackageNameToFilename

(
    const FString& InLongPackageName,
    FString& OutFilename,
    const FString& InExtension
)

Tries to convert a long package name to a file name with the supplied extension.

Public function Static

bool

 

TryConvertShortPackagePathToLongInObjectPath

(
    const FString& ObjectPath,
    FString& ConvertedObjectPath
)

Tries to convert object path with short package name to object path with long package name found on disk (very slow)

Public function Static

void

 

UnRegisterMountPoint

(
    const FString& RootPath,
    const FString& ContentPath
)

This will remove a previously inserted mount point.

Typedefs

Name

Description

FDoesPackageExistOverride

Override whether a package exist or not.

FOnContentPathDismountedEvent

Event that is triggered when a new content path is removed

FOnContentPathMountedEvent

Event that is triggered when a new content path is mounted

FPackageNameStatVisitor

FPackageNameVisitor

This will recurse over a directory structure looking for packages.

Constants

Name

Description

AssetPackageExtension

DoesPackageExistOverrideDelegate

Delegate used to check whether a package exist without using the filesystem.

MapPackageExtension

OnContentPathDismountedEvent

Event that is triggered when a new content path is removed

OnContentPathMountedEvent

Event that is triggered when a new content path is mounted

TextAssetPackageExtension

TextMapPackageExtension

Deprecated Functions

Name Description

Public function Static

bool

 

ConvertRootPathToContentPath

(
    const FString& RootPath,
    FString& OutContentPath
)

  1. Call TryConvertLongPackageNameToFilename instead, which also works on nested paths

Public function Static

FString

 

PackageFromPath

(
    const TCHAR* InPathName
)

  1. Call TryConvertFilenameToLongPackageName instead

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss