28#include <wx/translation.h>
43 wxS(
"KICAD_USER_TEMPLATE_DIR" ),
44 wxS(
"KICAD_PTEMPLATES" ),
72 aVars->push_back( var );
82 return wxString::Format(
"KICAD%d_%s", version, aBaseName );
87 const wxString& aBaseName )
91 if( aMap.count( exactMatch ) )
92 return aMap.at( exactMatch ).GetValue();
94 wxString partialMatch = wxString::Format(
"KICAD*_%s", aBaseName );
96 for(
const auto& [k, v] : aMap )
98 if( k.Matches( partialMatch ) )
111 _(
"The base path of locally installed system footprint libraries (.pretty folders)." );
114 _(
"The base path of system footprint 3D shapes (.3Dshapes folders)." );
117 _(
"The base path of the locally installed symbol libraries." );
120 _(
"A directory containing project templates installed with KiCad." );
122 aMap[wxS(
"KICAD_USER_TEMPLATE_DIR" )] =
123 _(
"Optional. Can be defined if you want to create your own project templates folder." );
126 _(
"A directory containing 3rd party plugins, libraries and other downloadable content." );
128 aMap[wxS(
"KIPRJMOD" )] =
129 _(
"Internally defined by KiCad (cannot be edited) and is set to the absolute path of the currently "
130 "loaded project file. This environment variable can be used to define files and paths relative "
131 "to the currently loaded project. For instance, ${KIPRJMOD}/libs/footprints.pretty can be "
132 "defined as a folder containing a project specific footprint library named footprints.pretty." );
135 _(
"A directory containing system-wide scripts installed with KiCad." );
138 _(
"A directory containing user-specific scripts installed with KiCad." );
141#define DEP( var ) wxString::Format( _( "Deprecated version of %s." ), var )
154 static std::map<wxString, wxString> envVarHelpText;
156 if( envVarHelpText.size() == 0 )
159 return envVarHelpText[ aEnvVar ];
168 if( wxGetEnv( aEnvVarName, &env ) )
172 if( env.ToDouble( &value ) )
183 std::optional<wxString> optValue;
186 if( wxGetEnv( aEnvVarName, &env ) )
const std::tuple< int, int, int > & GetMajorMinorPatchTuple()
Get the build version numbers as a tuple.
static void initialiseEnvVarHelp(std::map< wxString, wxString > &aMap)
static const std::vector< wxString > predefinedEnvVars
List of pre-defined environment variables.
Functions related to environment variables, including help functions.
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
KICOMMON_API wxString LookUpEnvVarHelp(const wxString &aEnvVar)
Look up long-form help text for a given environment variable.
KICOMMON_API void GetEnvVarAutocompleteTokens(wxArrayString *aVars)
Return autocomplete tokens for environment variables for Scintilla.
KICOMMON_API std::optional< VAL_TYPE > GetEnvVar(const wxString &aEnvVarName)
Get an environment variable as a specific type, if set correctly.
KICOMMON_API std::optional< wxString > GetVersionedEnvVarValue(const std::map< wxString, ENV_VAR_ITEM > &aMap, const wxString &aBaseName)
Attempt to retrieve the value of a versioned environment variable, such as KICAD8_TEMPLATE_DIR.
KICOMMON_API const std::vector< wxString > & GetPredefinedEnvVars()
Get the list of pre-defined environment variables.
KICOMMON_API wxString GetVersionedEnvVarName(const wxString &aBaseName)
Construct a versioned environment variable based on this KiCad major version.
KICOMMON_API bool IsEnvVarImmutable(const wxString &aEnvVar)
Determine if an environment variable is "predefined", i.e.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.