Download

FXmlFile loading directory?

I’ve been trying to load in xml files from c++, just a simple FXmlNode(“filename.xml”). However it keeps failing to load, what directory its trying to load from?

You need to specify the path, It’ll probably just use the root directory but honestly never tried it…

Try this, using this example you’d want to put the files in the Root Directory of your project in another folder called ‘XMLFiles’



FXmlNode(FPaths::GameDir() + "XMLFiles/Filename.xml")


We load Text files into our own game using the following system:



	TArray<FString> TheSpawnArray;
	bool done = FFileHelper::LoadANSITextFileToStrings(*(FPaths::GameDir() + "Textfiles/SatelliteRole.txt"), NULL, TheSpawnArray);


Thanks, that did it. Side question: will the xml files be included with everything else when I cook the project?

Not at the moment, but you CAN include them in the Directory of the packaged game as well (how I’ve got around it atm).

Although, I haven’t tried placing them in the Content folder to see if that works… worth a try!