Last active
August 30, 2022 03:57
-
-
Save bohdon/92d86724b91ec0791631453c3496e5cf to your computer and use it in GitHub Desktop.
read a config value in a UE4 ModuleRules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Get a value from a config file for the project of the current target | |
/// </summary> | |
/// <returns>true if a value was found for the given section and key</returns> | |
bool TryGetConfigValue(ConfigHierarchyType ConfigType, string SectionName, string KeyName, out string Value) | |
{ | |
ConfigHierarchy Config = ConfigCache.ReadHierarchy(ConfigType, DirectoryReference.FromFile(Target.ProjectFile), Target.Platform); | |
if (Config != null) | |
{ | |
ConfigHierarchySection Section = Config.FindSection(SectionName); | |
if (Section != null) | |
{ | |
return Section.TryGetValue(KeyName, out Value); | |
} | |
} | |
Value = null; | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment