Strip Config values from ini files based on target configuration when building

Hello,

We have some settings we store as config values in a few ini files throughout our project. This works well for us except for when buidling for certain configurations in which we don’t want these values to be packaged for. We have an idea in mind for how to go about resolving this, but are wondering too if there’s already an existing solution that would solve this issue for us? I’ve done some quick looking into the engine but haven’t noticed anything.

Thank you!

Hi,

Outside of the config file hierarchy, you could explore modifying the target.cs file to read in a custom config directory or file based on build configuration.

Something along the lines of :

`// requires source engine
BuildEnvironment = TargetBuildEnvironment.Unique;

if (Target.Platform == UnrealTargetPlatform.Win64 && Target.Configuration == UnrealTargetConfiguration.DebugGame)
{

// this to override a specic ini file
AdditionalCompilerArguments = “-DefIni=<FILE_NAME>”;

// or this to override the entiore directory
CustomConfig = “ConfigWindowsDebugGame”;

}`See ConfigHeirarchy.h for more information on using the CustomConfig command and here for more information on overriding the default ini file via command line.

I hope this is helpful.

Hi Tristan,

That sounds good! The usage of the target.cs is very similar to the idea we have in mind. We will be sure to check out the configuration file hierarchy too.

We appreciate your input! Thank you!