Navigation
API > API/Runtime > API/Runtime/CoreUObject > API/Runtime/CoreUObject/Misc
References
| Module | CoreUObject |
| Header | /Engine/Source/Runtime/CoreUObject/Public/Misc/PackageName.h |
| Include | #include "Misc/PackageName.h" |
Syntax
class FPackageName
Functions
| Type | Name | Description | |
|---|---|---|---|
| FString | ConvertToLongScriptPackageName
(
const TCHAR* InShortName |
Helper function for converting short to long script package name (InputCore -> /Script/InputCore) | |
| bool | DoesPackageExist
(
const FString& LongPackageName, |
Checks if the package exists on disk. | |
| bool | DoesPackageExist
(
const FPackagePath& PackagePath, |
Checks if the package exists on disk. PackagePath must be a mounted path, otherwise returns false | |
| bool | DoesPackageExist
(
const FPackagePath& PackagePath, |
Checks if the package exists on disk. PackagePath must be a mounted path, otherwise returns false | |
| EPackageLocationFilter | DoesPackageExistEx
(
const FPackagePath& PackagePath, |
Checks if the package exists in IOStore containers, on disk outsode of IOStore, both, or neither | |
| FDoesPackageExistOverride & | |||
| bool | DoesPackageNameContainInvalidCharacters
(
FStringView InLongPackageName, |
Checks if a package name contains characters that are invalid for package names. | |
| bool | DoesPackageNameContainInvalidCharacters
(
FStringView InLongPackageName, |
Checks if a package name contains characters that are invalid for package names. | |
| FString | ExportTextPathToObjectPath
(
const TCHAR* InExportTextPath |
Returns the path to the object referred to by the supplied export text path, excluding the class name. | |
| FString | ExportTextPathToObjectPath
(
const FString& InExportTextPath |
Returns the path to the object referred to by the supplied export text path, excluding the class name. | |
| FAnsiStringView | ExportTextPathToObjectPath
(
FAnsiStringView InExportTextPath |
Returns the path to the object referred to by the supplied export text path, excluding the class name. | |
| FWideStringView | ExportTextPathToObjectPath
(
FWideStringView InExportTextPath |
Returns the path to the object referred to by the supplied export text path, excluding the class name. | |
| FString | FilenameToLongPackageName
(
const FString& InFilename |
Converts the supplied filename to long package name. | |
| bool | FindPackageFileWithoutExtension
(
const FString& InPackageFilename, |
Checks if a package can be found using known package extensions (header extensions only; files with the extensions of other segments are not returned). | |
| bool | FindPackagesInDirectories
(
TArray< FString >& OutPackages, |
This will recurse over the given list of directory structures looking for packages. | |
| bool | FindPackagesInDirectory
(
TArray< FString >& OutPackages, |
This will recurse over a directory structure looking for packages. | |
| FName * | FindScriptPackageName
(
FName InShortName |
Finds long script package name associated with a short package name. | |
| bool | FixPackageNameCase
(
FString& LongPackageName, |
Converts a long package name to the case it exists as on disk. | |
| FString | FormatErrorAsString
(
FStringView InPath, |
Return a user-readable string for the error code returned from a FPackageName function | |
| FText | FormatErrorAsText
(
FStringView InPath, |
Return a user-readable string for the error code returned from a FPackageName function | |
| const FString & | Returns the file extension for packages containing assets. | ||
| FString | GetContentPathForPackageRoot
(
FStringView InPackageRoot |
Get the path associated with the given package root | |
| FString | GetDelegateResolvedPackagePath
(
const FString& InSourcePackagePath |
Gets the resolved path of a long package as determined by the delegates registered with FCoreDelegates::PackageNameResolvers. | |
| FString | GetLocalizedPackagePath
(
const FString& InSourcePackagePath, |
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. | |
| 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. | |
| FString | GetLongPackageAssetName
(
const FString& InLongPackageName |
Returns the clean asset name for the specified package, same as GetShortName | |
| FString | GetLongPackagePath
(
const FString& InLongPackageName |
Returns the path to the specified package, excluding the short package name | |
| const FString & | Returns the file extension for packages containing assets. | ||
| FName | GetModuleScriptPackageName
(
FName ModuleName |
Return the LongPackageName of module's native script package. | |
| FString | GetModuleScriptPackageName
(
FStringView ModuleName |
Return the LongPackageName of module's native script package. | |
| FString | GetNormalizedObjectPath
(
const FString& ObjectPath |
Gets normalized object path i.e. with long package format. | |
| FName | GetPackageMountPoint
(
const FString& InPackagePath, |
Get the mount point for a given package path | |
| FName | GetShortFName
(
const FString& LongName |
Converts package name to short name. | |
| FName | GetShortFName
(
const FName& LongName |
Converts package name to short name. | |
| FName | GetShortFName
(
const TCHAR* LongName |
Converts package name to short name. | |
| FString | GetShortName
(
const UPackage* Package |
Converts package name to short name. | |
| FString | GetShortName
(
const FString& LongName |
Converts package name to short name. | |
| FString | GetShortName
(
const FName& LongName |
Converts package name to short name. | |
| FString | GetShortName
(
const TCHAR* LongName |
Converts package name to short name. | |
| FString | GetSourcePackagePath
(
const FString& InLocalizedPackagePath |
Gets the source version of a localized long package path (it is also safe to pass non-localized paths into this function). | |
| const FString & | Returns the file extension for packages containing text assets. | ||
| const FString & | Returns the file extension for packages containing text maps. | ||
| bool | IsAssetPackageExtension
(
const TCHAR* Ext |
Returns whether the passed in extension is a valid binary asset package extension. | |
| bool | IsLocalizedPackage
(
FStringView InPackageName |
Checks the root of the package's path to see if it is a localized package | |
| bool | IsMapPackageExtension
(
const TCHAR* Ext |
Returns whether the passed in extension is a valid binary map package extension. | |
| 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 | |
| bool | IsPackageExtension
(
EPackageExtension Extension |
Returns whether the passed in extension is a valid binary package extension. | |
| bool | IsPackageExtension
(
const TCHAR* Ext |
Returns whether the passed in extension is a valid binary package extension. | |
| bool | IsPackageFilename
(
FStringView Filename |
Returns whether the passed in filename ends with any of the known package extensions. | |
| bool | IsScriptPackage
(
FStringView InPackageName |
Checks the root of the package's path to see if it is a script package | |
| bool | IsShortPackageName
(
FStringView PossiblyLongName |
Checks if the string is a ShortPackageName. | |
| bool | IsShortPackageName
(
const FName PossiblyLongName |
Checks if the string is a ShortPackageName. | |
| bool | IsShortPackageName
(
const FString& PossiblyLongName |
Checks if the string is a ShortPackageName. | |
| 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. | |
| bool | IsTextAssetPackageExtension
(
const TCHAR* Ext |
Returns whether the passed in extension is a valid text asset package extension. | |
| bool | IsTextMapPackageExtension
(
const TCHAR* Ext |
Returns whether the passed in extension is a valid text map package extension. | |
| bool | IsTextPackageExtension
(
const TCHAR* Ext |
Returns whether the passed in extension is a valid text package extension. | |
| bool | IsTextPackageExtension
(
EPackageExtension Extension |
Returns whether the passed in extension is a text header extension | |
| bool | IsValidLongPackageName
(
FStringView InLongPackageName, |
Returns true if the path starts with a valid root (i.e. /Game/, /Engine/, etc) and contains no illegal characters. | |
| bool | IsValidLongPackageName
(
FStringView InLongPackageName, |
Returns true if the path starts with a valid root (i.e. /Game/, /Engine/, etc) and contains no illegal characters. | |
| bool | IsValidObjectPath
(
FStringView InObjectPath, |
Returns true if the path starts with a valid root (i.e. /Game/, /Engine/, etc) and contains no illegal characters. | |
| bool | IsValidPath
(
FStringView InPath |
Returns true if the path starts with a valid root (i.e. /Game/, /Engine/, etc). | |
| bool | IsValidTextForLongPackageName
(
FStringView InLongPackageName, |
Report whether a given name is the proper format for a PackageName, without checking whether it is in one of the registered mount points | |
| bool | IsValidTextForLongPackageName
(
FStringView InLongPackageName, |
Report whether a given name is the proper format for a PackageName, without checking whether it is in one of the registered mount points | |
| bool | IsVersePackage
(
FStringView InPackageName |
Checks the package's path to see if it's a Verse package | |
| void | IteratePackagesInDirectory
(
const FString& RootDir, |
||
| void | IteratePackagesInDirectory
(
const FString& RootDir, |
||
| FString | LongPackageNameToFilename
(
const FString& InLongPackageName, |
Converts a long package name to a file name with the supplied extension. | |
| bool | MountPointExists
(
const FString& RootPath |
Returns whether the specific logical root path is a valid mount point. | |
| FString |
ObjectPathToObjectName
(
const FString& InObjectPath |
Returns the name of the leaf object referred to by the specified object path | |
| FAnsiStringView |
ObjectPathToObjectName
(
FAnsiStringView InObjectPath |
Returns the name of the leaf object referred to by the specified object path | |
| FWideStringView |
ObjectPathToObjectName
(
FWideStringView InObjectPath |
Returns the name of the leaf object referred to by the specified object path | |
| FAnsiStringView |
ObjectPathToOuterPath
(
FAnsiStringView InObjectPath |
Returns the path name of the outer of the leaf object referred to by the specified object path | |
| FWideStringView |
ObjectPathToOuterPath
(
FWideStringView InObjectPath |
Returns the path name of the outer of the leaf object referred to by the specified object path | |
| FString |
ObjectPathToOuterPath
(
const FString& InObjectPath |
Returns the path name of the outer of the leaf object referred to by the specified object path | |
| FString |
ObjectPathToPackageName
(
const FString& InObjectPath |
Returns the name of the package referred to by the specified object path | |
| FWideStringView |
ObjectPathToPackageName
(
FWideStringView InObjectPath |
Returns the name of the package referred to by the specified object path | |
| FAnsiStringView |
ObjectPathToPackageName
(
FAnsiStringView InObjectPath |
Returns the name of the package referred to by the specified object path | |
| FString |
ObjectPathToPathWithinPackage
(
const FString& InObjectPath |
Returns any remaining object path after trimming the package name from the specified object path | |
| FWideStringView |
ObjectPathToPathWithinPackage
(
FWideStringView InObjectPath |
Returns any remaining object path after trimming the package name from the specified object path | |
| FAnsiStringView |
ObjectPathToPathWithinPackage
(
FAnsiStringView InObjectPath |
Returns any remaining object path after trimming the package name from the specified object path | |
| FWideStringView |
ObjectPathToSubObjectPath
(
FWideStringView InObjectPath |
Returns the path from (and including) the subobject referred to by the specified object path | |
| FString |
ObjectPathToSubObjectPath
(
const FString& InObjectPath |
Returns the path from (and including) the subobject referred to by the specified object path | |
| FAnsiStringView |
ObjectPathToSubObjectPath
(
FAnsiStringView InObjectPath |
Returns the path from (and including) the subobject referred to by the specified object path | |
| FOnContentPathDismountedEvent & | |||
| FOnContentPathMountedEvent & | |||
| void | If the FLongPackagePathsSingleton is not created yet, this function will create it and thus allow mount points to be added | ||
| bool | ParseExportTextPath
(
FAnsiStringView InExportTextPath, |
Converts the supplied export text path to an object path and class name. | |
| bool | ParseExportTextPath
(
FWideStringView InExportTextPath, |
Converts the supplied export text path to an object path and class name. | |
| bool | ParseExportTextPath
(
const TCHAR* InExportTextPath, |
Converts the supplied export text path to an object path and class name. | |
| bool | ParseExportTextPath
(
const FString& InExportTextPath, |
Converts the supplied export text path to an object path and class name. | |
| void | QueryRootContentPaths
(
TArray< FString >& OutRootContentPaths, |
Queries all of the root content paths, like "/Game/", "/Engine/", and any dynamically added paths | |
| void | RegisterMountPoint
(
const FString& RootPath, |
This will insert a mount point at the head of the search chain (so it can overlap an existing mount point and win). | |
| void | Registers all short package names found in ini files. | ||
| bool | SearchForPackageOnDisk
(
const FString& PackageName, |
Attempts to find a package given its short name on disk (very slow). | |
| void | SplitFullObjectPath
(
FStringView InFullObjectPath, |
||
| void | Split a full object path (Class /Path/To/A/Package.Object:SubObject) into its constituent pieces | ||
| bool | SplitLongPackageName
(
const FString& InLongPackageName, |
Convert a long package name into root, path, and name components | |
| FStringView | SplitPackageNameRoot
(
FStringView InPackageName, |
Returns the top level 'directory' in a package name. | |
| bool | TryConvertFilenameToLongPackageName
(
const FString& InFilename, |
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. | |
| bool | TryConvertGameRelativePackagePathToLocalPath
(
FStringView RelativePackagePath, |
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). | |
| bool | TryConvertLongPackageNameToFilename
(
const FString& InLongPackageName, |
Tries to convert a long package name to a file name with the supplied extension. | |
| bool | TryConvertShortPackagePathToLongInObjectPath
(
const FString& ObjectPath, |
Tries to convert object path with short package name to object path with long package name found on disk (very slow) | |
| bool | TryConvertToMountedPath
(
FStringView InPath, |
Find the MountPoint for a LocalPath, LongPackageName, or ObjectPath and return its elements. | |
| bool | TryGetMountPointForPath
(
FStringView InFilePathOrPackageName, |
Find a mount point that contains the given LocalFilePath or PackageName, and if found, return the MountPoint and RelativePath | |
| void | UnRegisterMountPoint
(
const FString& RootPath, |
This will remove a previously inserted mount point. |
Enums
| Type | Name | Description | |
|---|---|---|---|
| EErrorCode | |||
| EFlexNameType | Indicates the format the input was in in functions that take flexible input that can be a LocalPath, PackageName, or ObjectPath | ||
| EPackageLocationFilter |
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 |
|---|---|
| DoesPackageExistOverrideDelegate | Delegate used to check whether a package exist without using the filesystem. |
| OnContentPathDismountedEvent | Event that is triggered when a new content path is removed |
| OnContentPathMountedEvent | Event that is triggered when a new content path is mounted |
Deprecated Functions
| Type | Name | Description | |
|---|---|---|---|
| bool | DoesPackageExist
(
const FString& LongPackageName, |
Deprecated. UPackage::Guid has not been used by the engine for a long time. Call DoesPackageExist without a Guid. | |
| bool | FindPackageFileWithoutExtension
(
const FString& InPackageFilename, |
Specifying AllowTextFormats is no longer supported. Text format is instead specified as a field on the result struct from IPackageResourceManager->OpenReadPackage. |