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

@@ -18,7 +18,14 @@ enum wxXmlResourceFlags
/** Prevent the XRC files from being reloaded from disk in case they have been modified there
since being last loaded (may slightly speed up loading them). */
wxXRC_NO_RELOADING = 4
wxXRC_NO_RELOADING = 4,
/**
Expand environment variables for paths in XRC (such as bitmaps or icons).
@since 3.1.3
*/
wxXRC_USE_ENVVARS = 8
};
@@ -737,6 +744,16 @@ protected:
*/
wxString GetText(const wxString& param, bool translate = true);
/**
Gets a file path from the given node.
This function expands environment variables in the path if
wxXRC_USE_ENVVARS is used.
@since 3.1.3
*/
wxString GetFilePath(const wxXmlNode* node);
/**
Check to see if a parameter exists.
*/