You are viewing documentation for v1.1. Switch to current version โ†’

๐Ÿ“„ File Helper

Short Description

Utilities for common file operations: existence checks, read/write, copy/move and simple text edits.

Long Description

GorgeousFileHelper provides small, well-tested wrappers around the engine file APIs. They simplify working with files from build tools, plugin installers and runtime utilities by returning boolean success flags and handling common edge cases (read-only files, path normalization).

๐Ÿš€ Features

  • Check file existence and read-only state.
  • Read and write whole files.
  • Copy, move and delete files safely.
  • Simple insert/replace/delete operations for textual files.
  • Find files by pattern and query file sizes.

IsGorgeousFilePresent

Returns true if the file exists at the given path.

Parameter Name Type Description
FilePath FString Path to the file to check.
if (GorgeousFileHelper::IsGorgeousFilePresent(FilePath)) {
    // proceed
}

ReadGorgeousFile / WriteGorgeousFile

Read/Write entire file contents. Reading returns content as FString or fills a buffer; writing overwrites the file and returns whether the operation succeeded.

Parameter Name Type Description
FilePath FString Path to the file.
Content FString (write only) Content to write.
FString Content;
if (GorgeousFileHelper::ReadGorgeousFile(FilePath, Content)) {
    // use Content
}

bool bOk = GorgeousFileHelper::WriteGorgeousFile(FilePath, NewContent);

CopyGorgeousFile / MoveOrRenameGorgeousFile / DeleteGorgeousFile

Helpers for copying, moving (or renaming) and deleting files. They return true on success and offer simple safety checks.

Parameter Name Type Description
SourcePath FString Source file path.
DestinationPath FString Destination path for copy/move.
GorgeousFileHelper::CopyGorgeousFile(Src, Dst);
GorgeousFileHelper::MoveOrRenameGorgeousFile(Src, Dst);
GorgeousFileHelper::DeleteGorgeousFile(Target);

Text editing helpers: InsertInGorgeousFile, ReplaceInGorgeousFile, DeleteInGorgeousFile, ExistInGorgeousFile

Tiny helpers to manipulate text files: check if a substring exists, insert new text at a given offset, replace occurrences and remove ranges. These are convenient for simple code generation or small patching tasks.

Parameter Name Type Description
FilePath FString Target file.
Search / Replace / Insert FString Text used by the operation.
if (!GorgeousFileHelper::ExistInGorgeousFile(Path, TEXT("marker"))) {
    GorgeousFileHelper::InsertInGorgeousFile(Path, TEXT("marker\n"), 0);
}
GorgeousFileHelper::ReplaceInGorgeousFile(Path, TEXT("old"), TEXT("new"));

FindGorgeousFiles / GetGorgeousFileSize / GetGorgeousFilesInDirectory

Helpers to query files by pattern and to obtain file sizes. Useful when building asset lists or scanning plugin folders.

TArray<FString> Matches;
GorgeousFileHelper::FindGorgeousFiles(SearchDir, TEXT("*.uasset"), Matches);
int64 Size = GorgeousFileHelper::GetGorgeousFileSize(SomeFile);