11#include "Misc/Paths.h"
12#include "HAL/PlatformFileManager.h"
16 UCSVFile* CSVFile = NewObject<UCSVFile>(UCSVFile::StaticClass());
20 CSVFile->
Create(FileNameWithoutExtension, Settings);
32 FString BasePath = Settings.
CustomPath.IsEmpty() ? DataDirectory +
"/CSV/" : Settings.
CustomPath;
33 IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
34 if (!PlatformFile.DirectoryExists(*BasePath))
36 PlatformFile.CreateDirectoryTree(*BasePath);
39 FString FullPath = FPaths::Combine(*BasePath, FileNameWithoutExtension + TEXT(
".csv"));
40 UE_LOG(LogTemp, Warning, TEXT(
"FullPath: %s"), *FullPath);
45 while (FPaths::FileExists(FullPath))
47 FullPath = FPaths::Combine(*BasePath, FileNameWithoutExtension + FString::Printf(TEXT(
"_%d.csv"), Counter++));
68 std::ios_base::openmode Mode = std::ios::out;
71 Mode |= std::ios::app;
83 FString Delimiter = TEXT(
",");
86 Delimiter = TEXT(
";");
90 Delimiter = TEXT(
"\t");
94 FString Line = FString::Join(Cells, *Delimiter);
112 CSVStream << TCHAR_TO_UTF8(*Line) << std::endl;
136 ConditionalBeginDestroy();
static FString GetDataFolder()
static UCSVFile * CreateCSVFile(const FString &FileNameWithoutExtension, const FCSVFileSettings &Settings)
void WriteRaw(const FString &Line)
void Create(const FString &FileNameWithoutExtension, const FCSVFileSettings &Settings)
TArray< FString > PendingRows
FCSVFileSettings CurrentSettings
void WriteRow(const TArray< FString > &Cells)
FCSVFileWriteOptions FileWriteOption