How do I get an array of files in a directory?

Kochab
Thu, 02 Nov 2017 19:03:31 +0000
Community & Industry Discussion

First, I get all the file names with IFileManager and FindFiles(). The correct file names are returned. Then I try to load all those files and push them into an array.

for (FString fileName : xmlFileNames) {
	GLog->Log("    " + fileName);
	FXmlFile xmlFile(FPaths::Combine(contentFolderPath, fileName)); // load file

	if (xmlFile.IsValid()) {
		xmlFiles.Push(xmlFile);
	}
	else
	{
		GLog->Log("   *** Error: Could not load " + fileName);
	}
}

This doesn’t compile. Here is the error:

C:\Program Files\Epic Games\UE_4.18\Engine\Source\Runtime\Core\Public\Containers/Array.h(1736): error C2248: 'FXmlFile::FXmlFile': cannot access private member declared in class 'FXmlFile'.

How can I get these files into my array? Thanks.

4 posts - 1 participant