bool UPMTextFileSave::SaveArrayText(FString SaveDirectory, FString FileName, TArray SaveText, bool AllowOverWriting = false)
{
SaveDirectory += “\”;
SaveDirectory += FileName;
if (AllowOverWriting)
{
if (FPlatformFileManager::Get().GetPlatformFile().FileExists(*SaveDirectory))
{
return false;
}
}
FString FinalString = "";
for (FString& Each : SaveText)
{
FinalString += Each;
FinalString += LINE_TERMINATOR;
}
return FFileHelper::SaveStringToFile(FinalString, *SaveDirectory);
}
For some reason, if there is an absent file name it will create one randomly sometimes the file named “.txt” will be a text file and sometimes it will be a folder named “.txt” I cannot figure out why and as a novice coder could use some help. The issue is… once the folder is created it is not able to be read or saved to as a “.txt” text file!