Files
josh adams 40b23a4c9b - Added ability to read plugins into a config hierarchy, controlled by passing optional IncludePluginsForTargetType param to ConfigCache.ReadHierarchy(), with a TargetType (like Game or Editor).
- Use this in CopyBuildToStagingDIrectory when reading the Packaging settings when staging. This allows plugins to add files/directories to stage without needing to modify every project.
- Added a ConfigTester Turnkey command that can help test C# inis programmatically. Currently need to pass in these 3 params on commandline, it doesn't ask for them: -Branch=Engine -Section=SomeSection -Key=SomeKey

#rb David.Harvey

[CL 35927236 by josh adams in ue5-main branch]
2024-08-30 11:05:34 -04:00

41 lines
1.3 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EpicGames.Core;
using UnrealBuildTool;
using UnrealBuildBase;
namespace Turnkey.Commands
{
class ConfigTester : TurnkeyCommand
{
protected override CommandGroup Group => CommandGroup.Misc;
protected override void Execute(string[] CommandOptions)
{
FileReference ProjectFile = TurnkeyUtils.GetProjectFromCommandLineOrUser(CommandOptions);
List<UnrealTargetPlatform> Platforms = TurnkeyUtils.GetPlatformsFromCommandLineOrUser(CommandOptions, null);
string BranchName = TurnkeyUtils.ParseParamValue("Branch", null, CommandOptions);
string Section = TurnkeyUtils.ParseParamValue("Section", null, CommandOptions);
string Key = TurnkeyUtils.ParseParamValue("Key", null, CommandOptions);
ConfigHierarchyType Branch = Enum.Parse<ConfigHierarchyType>(BranchName);
// get a list of builds from config
foreach (UnrealTargetPlatform Platform in Platforms)
{
ConfigHierarchy Config = ConfigCache.ReadHierarchy(Branch, ProjectFile == null ? null : ProjectFile.Directory, Platform, IncludePluginsForTargetType:TargetType.Game);
string Value;
Config.GetString(Section, Key, out Value);
TurnkeyUtils.Log($"Value[{Platform}]: {Value}");
}
}
}
}