RealDocs

UKismetSystemLibrary::ConvertToRelativePath

function Engine Blueprint Since 4.0
#include "Kismet/KismetSystemLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Converts the passed-in filename to use a path relative to the current process's base directory.

Caveats & Gotchas

  • Not marked BlueprintThreadSafe, unlike most other path helpers in this library — avoid calling it from background threads in Blueprint.
  • "Relative" means relative to FPlatformProcess::BaseDir(), which differs between editor and packaged builds — don't assume the result is relative to the project root.
  • Wraps FPaths::MakePathRelativeTo internally; if the input path isn't under the base directory the result can still be an absolute or oddly-relative path.

Signature

static FString ConvertToRelativePath(const FString& Filename)

Parameters

Name Type Description Default
Filename const FString& The filename/path to convert.

Return Type

FString

Example

Shorten an absolute path for display C++
FString ShortPath = UKismetSystemLibrary::ConvertToRelativePath(AbsoluteFilePath);

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.