RealDocs

UBlueprintPathsLibrary::DirectoryExists

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

Description

Returns true if a directory exists at the given path, false otherwise.

Caveats & Gotchas

  • Like FileExists, this hits the filesystem synchronously; avoid polling it on a per-frame basis.
  • Passing a path that points at a file rather than a directory returns false, not true.

Signature

static bool DirectoryExists(const FString& InPath)

Parameters

Name Type Description Default
InPath const FString& The directory path to check.

Return Type

bool

Example

Check a directory before writing to it C++
if (!UBlueprintPathsLibrary::DirectoryExists(TEXT("Saved/Screenshots")))
{
	IFileManager::Get().MakeDirectory(*FPaths::ProjectSavedDir(), true);
}

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.