Allow expanding environment variables in XRC file paths

Add a new flag wxXRC_USE_ENVVARS for wxXmlResourceFlags that triggers a
call to wxExpandEnvVars() for bitmap, icon and animation paths.

This flag is not set by default to avoid silently changing the behaviour
of existing applications.

Closes https://github.com/wxWidgets/wxWidgets/pull/1445
This commit is contained in:
ousnius
2019-07-28 13:36:19 +02:00
committed by Vadim Zeitlin
parent cd2e3dd2cf
commit 2a2fa8c5af
6 changed files with 55 additions and 6 deletions

View File

@@ -90,6 +90,10 @@ bool MyApp::OnInit()
// wxXRC docs for details.
wxXmlResource::Get()->InitAllHandlers();
// Allow using environment variables in the file paths in the resources,
// while keeping the default wxXRC_USE_LOCALE flag.
wxXmlResource::Get()->SetFlags(wxXRC_USE_LOCALE | wxXRC_USE_ENVVARS);
#if wxUSE_RIBBON
wxXmlResource::Get()->AddHandler(new wxRibbonXmlHandler);
#endif