From e2f47ecabbfd7a73e64bb5a4f6d62ed7cf100fe4 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Wed, 12 Jul 2023 11:26:26 -0400 Subject: [PATCH] Common: add GetTextVars for unexpanded variable names --- common/common.cpp | 12 ++++++++++++ include/common.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/common/common.cpp b/common/common.cpp index a3c7535d2d..96b5d665d9 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -112,6 +112,18 @@ wxString ExpandTextVars( const wxString& aSource, } +wxString GetTextVars( const wxString& aSource ) +{ + std::function tokenExtractor = + [&]( wxString* token ) -> bool + { + return true; + }; + + return ExpandTextVars( aSource, &tokenExtractor ); +} + + // // Stolen from wxExpandEnvVars and then heavily optimized // diff --git a/include/common.h b/include/common.h index d907efdbd6..5e00c9ada3 100644 --- a/include/common.h +++ b/include/common.h @@ -91,6 +91,11 @@ wxString ExpandTextVars( const wxString& aSource, wxString ExpandTextVars( const wxString& aSource, const PROJECT* aProject ); +/** + * Returns any variables unexpanded, e.g. ${VAR} -> VAR + */ +wxString GetTextVars( const wxString& aSource ); + /** * Replace any environment and/or text variables in file-path uris (leaving network-path URIs * alone).