UBlueprintPathsLibrary::GetBaseFilename
#include "Kismet/BlueprintPathsLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the same result as GetCleanFilename, but with the extension removed as well. Set bRemovePath=false to keep the directory portion.
Caveats & Gotchas
- • The bRemovePath parameter is easy to overlook — leaving it at the default true silently drops any directory information, which can surprise callers expecting a full path minus extension.
- • A filename with multiple dots (e.g. "Archive.tar.gz") only has the last extension removed, leaving "Archive.tar".
Signature
static FString GetBaseFilename(const FString& InPath, bool bRemovePath = true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InPath | const FString& | The path or filename to extract the base name from. | — |
| bRemovePath | bool | If true, strips the directory path as well as the extension. If false, keeps the directory but drops the extension. | true |
Return Type
FString Examples
Get filename without extension or path C++
FString Base = UBlueprintPathsLibrary::GetBaseFilename(TEXT("Content/Textures/Rock.png"));
// Base == TEXT("Rock") Keep the directory, drop only the extension C++
FString BaseWithPath = UBlueprintPathsLibrary::GetBaseFilename(TEXT("Content/Textures/Rock.png"), false);
// BaseWithPath == TEXT("Content/Textures/Rock") See Also
Tags
Version History
Introduced in: 4.20
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?