You've already forked LuckyWorld
24 lines
645 B
C++
24 lines
645 B
C++
#include "_Utils/FileUtils.h"
|
|
#include "Misc/FileHelper.h"
|
|
#include "Misc/Paths.h"
|
|
|
|
UFileUtils::UFileUtils()
|
|
{
|
|
}
|
|
|
|
|
|
|
|
bool UFileUtils::WriteJsonlFile(const TArray<FString>& JsonLines, const FString& BasePath, const FString& FileName)
|
|
{
|
|
// Ensure the directory exists
|
|
IFileManager::Get().MakeDirectory(*BasePath, true);
|
|
|
|
// Construct the full file path
|
|
const FString FullFilePath = FPaths::Combine(BasePath, FileName + TEXT(".jsonl"));
|
|
|
|
// Join the array into one string with line breaks
|
|
const FString FileContent = FString::Join(JsonLines, TEXT(""));
|
|
|
|
// Write to file
|
|
return FFileHelper::SaveStringToFile(FileContent, *FullFilePath);
|
|
} |