Static Public Member Functions | List of all members
UBPUtilsPathLibrary Class Reference

Static Public Member Functions

static FString JoinPaths (const FString &A, const FString &B)
 Joins the given paths and ensures the path is valid. More...
 
static FString LoadFileToString (const FString &Path, bool &Success)
 Loads a file at the given path to a string. More...
 
static TArray< FString > LoadFileToStringArray (const FString &Path, bool &Success)
 Loads a file at the given path to an array of strings, one for each line. More...
 
static void WriteStringToFile (const FString &Path, const FString &Contents, bool &Success)
 Writes a string to a file. More...
 
static void WriteStringArrayToFile (const FString &Path, const TArray< FString > &Contents, bool &Success)
 Writes an array of strings to a file, separated by newlines. More...
 
static void DeleteFile (const FString &Path, const bool RequireExists, const bool EvenReadOnly, bool &Success)
 Tries to delete a file. More...
 

Member Function Documentation

◆ DeleteFile()

void UBPUtilsPathLibrary::DeleteFile ( const FString &  Path,
const bool  RequireExists,
const bool  EvenReadOnly,
bool &  Success 
)
static

Tries to delete a file.

Parameters
PathPath to the file to delete.
RequireExistsIf true, Success = false if the file didn't already exist.
EvenReadOnlyWill only delete read-only files if this is true.
Return values
SuccessTrue if the file was deleted successfully.
path-deletefile.png

◆ JoinPaths()

FString UBPUtilsPathLibrary::JoinPaths ( const FString &  A,
const FString &  B 
)
static

Joins the given paths and ensures the path is valid.

Ensures that / is between the two paths, normalizes \\ to /, and removes redundant slashes.

Parameters
ALeft path operand
BRight path operand
Returns
The two strings joined as a path.
path-join.png

◆ LoadFileToString()

FString UBPUtilsPathLibrary::LoadFileToString ( const FString &  Path,
bool &  Success 
)
static

Loads a file at the given path to a string.

Parameters
PathPath to the file.
Returns
The file as a single string.
Return values
SuccessTrue if the file was read successfully.
path-loadfilestring.png

◆ LoadFileToStringArray()

TArray< FString > UBPUtilsPathLibrary::LoadFileToStringArray ( const FString &  Path,
bool &  Success 
)
static

Loads a file at the given path to an array of strings, one for each line.

Parameters
PathPath to the file.
Returns
The file as an array of strings.
Return values
SuccessTrue if the file was read successfully.
path-loadfilearray.png

◆ WriteStringArrayToFile()

void UBPUtilsPathLibrary::WriteStringArrayToFile ( const FString &  Path,
const TArray< FString > &  Contents,
bool &  Success 
)
static

Writes an array of strings to a file, separated by newlines.

Parameters
PathPath to the file.
ContentsThe string array to write.
Return values
SuccessTrue if the file was written to successfully.
path-writefilearray.png

◆ WriteStringToFile()

void UBPUtilsPathLibrary::WriteStringToFile ( const FString &  Path,
const FString &  Contents,
bool &  Success 
)
static

Writes a string to a file.

Parameters
PathPath to the file.
ContentsThe string to write.
Return values
SuccessTrue if the file was written to successfully.
path-writefilestring.png