Data files and paths

In the game I’m working on, there will be a LOT of data - textual and otherwise - that needs to be stored in asset files, in XML. I’ve made a “Data” subfolder, and I can hardwire a path in the


FXmlFile( FString path )

API, such as “C:/dev/game/data/foo.xml”, but how do I specify a relative path? Is there a function which gets the game directory and I can concatenate “/data/foo.xml” onto it? Or is “data/foo.xml” sufficient to identify the file in both the editor and packaged versions of the game?

I think you can use something like this :


FPaths::GameDir() + "/data/foo.xml"

More informations about FPaths here : FPaths | Unreal Engine Documentation

I hope this help you ! :slight_smile:

Thanks Jackblue, that’s just what I was after!

This came up on Google when looking for a helper method to combine paths, so I wanted to point out that you could also use (if you’re storing assets in the Content directory):

FPaths::Combine(FPaths::EngineContentDir(), "data", "foo.xml");