From 1ada5d27181c48ec125aeb50220bfb3e21cf6b68 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Sat, 18 Jun 2022 04:19:01 +0700 Subject: [PATCH] Add `Feature` ability to return current config --- sources/Features/Feature.uc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sources/Features/Feature.uc b/sources/Features/Feature.uc index 9c4656d..2daff5c 100644 --- a/sources/Features/Feature.uc +++ b/sources/Features/Feature.uc @@ -215,6 +215,22 @@ public static final function Text GetAutoEnabledConfig() return default.configClass.static.GetAutoEnabledConfig(); } +/** + * Returns name of the currently enabled config for the caller `Feature`. + * + * @return Name of the currently enabled for the caller `Feature`. + * `none` if `Feature` is not currently enabled. + */ +public static final function Text GetCurrentConfig() +{ + local Feature myInstance; + myInstance = GetInstance(); + if (myInstance == none) return none; + if (myInstance.currentConfigName == none) return none; + + return myInstance.currentConfigName.Copy(); +} + /** * Checks whether caller `Feature` is currently enabled. *