KiCad PCB EDA Suite
|
KiCad uses environment variables internally for determining the base paths for libraries, templates, and other assets that can be relocated by packagers or users. More...
#include <environment.h>
Public Member Functions | |
ENV_VAR_ITEM (const wxString &aValue=wxEmptyString, bool aIsDefinedExternally=false) | |
ENV_VAR_ITEM (const wxString &aKey, const wxString &aValue, const wxString &aDefaultValue=wxEmptyString) | |
~ENV_VAR_ITEM () throw () | |
bool | GetDefinedExternally () const |
void | SetDefinedExternally (bool aIsDefinedExternally=true) |
bool | GetDefinedInSettings () const |
void | SetDefinedInSettings (bool aDefined=true) |
wxString | GetKey () const |
const wxString & | GetValue () const |
void | SetValue (const wxString &aValue) |
wxString | GetDefault () const |
wxString | GetSettingsValue () const |
void | SetSettingsValue (const wxString &aValue) |
bool | GetBuiltin () const |
bool | IsDefault () const |
Checks if the variable matches its default value (always false for non-built-in vars) | |
Private Attributes | |
wxString | m_key |
The environment variable string key. | |
wxString | m_value |
The environment variable string value. | |
wxString | m_defaultValue |
The default value, for built-in variables that are always defined. | |
wxString | m_settingsValue |
The value that was originally loaded from JSON. | |
bool | m_isBuiltin |
Set to true for KiCad built-in variables that are always defined one way or another. | |
bool | m_isDefinedExternally |
Flag to indicate if the environment variable was defined externally to the process. | |
bool | m_isDefinedInSettings |
Flag to indicate if the environment variable was defined in the settings file. | |
KiCad uses environment variables internally for determining the base paths for libraries, templates, and other assets that can be relocated by packagers or users.
Because setting environment variables is not user-friendly on most platforms, KiCad supports two backing stores for these internal variables: the system environment, and the settings system.
We also want to make it possible to change the names and values of environment variables over time with minimal impact to users. Since most users do not customize these variables beyond any customization provided by the packager for their platform, an easy way to get this possibility with minimal user impact is to just not store environment variables if they match the internal (compiled-in) default.
The way environment variables are resolved is (highest to lowest priority):
1) Variables set at runtime via the Configure Paths dialog 2) Variables set in the system environment 3) Variables loaded from the settings system (stored in COMMON_SETTINGS)
For all KiCad system variables, we allow users to change the values at runtime via the Configure Paths dialog. If these variables were set in the system environment, we do not persist any changes made at runtime (and warn the user about this). If the variables were not set in the environment (meaning they were either the default value, or loaded from the settings system), we persist the changes via the settings system. Any variables that match the internal default are not saved in the settings, so that the internal defaults can be changed and the change will not be overridden by an old value cached in the settings file. A simple helper class to store environment variable definitions and values. This is used to initialize the environment variables that are built-in to KiCad, and also to store any variables created by the user.
Definition at line 59 of file include/settings/environment.h.
|
inline |
Definition at line 62 of file include/settings/environment.h.
|
inline |
Definition at line 70 of file include/settings/environment.h.
|
inline |
Definition at line 81 of file include/settings/environment.h.
|
inline |
Definition at line 102 of file include/settings/environment.h.
References m_isBuiltin.
|
inline |
Definition at line 97 of file include/settings/environment.h.
References m_defaultValue.
|
inline |
Definition at line 83 of file include/settings/environment.h.
References m_isDefinedExternally.
|
inline |
Definition at line 89 of file include/settings/environment.h.
References m_isDefinedInSettings.
|
inline |
Definition at line 92 of file include/settings/environment.h.
References m_key.
|
inline |
Definition at line 99 of file include/settings/environment.h.
References m_settingsValue.
|
inline |
Definition at line 94 of file include/settings/environment.h.
References m_value.
|
inline |
Checks if the variable matches its default value (always false for non-built-in vars)
Definition at line 108 of file include/settings/environment.h.
References m_defaultValue, m_isBuiltin, and m_value.
|
inline |
Definition at line 84 of file include/settings/environment.h.
References m_isDefinedExternally.
|
inline |
Definition at line 90 of file include/settings/environment.h.
References m_isDefinedInSettings.
|
inline |
Definition at line 100 of file include/settings/environment.h.
References m_settingsValue.
|
inline |
Definition at line 95 of file include/settings/environment.h.
References m_value.
|
private |
The default value, for built-in variables that are always defined.
Definition at line 121 of file include/settings/environment.h.
Referenced by GetDefault(), and IsDefault().
|
private |
Set to true for KiCad built-in variables that are always defined one way or another.
Definition at line 127 of file include/settings/environment.h.
Referenced by GetBuiltin(), and IsDefault().
|
private |
Flag to indicate if the environment variable was defined externally to the process.
Definition at line 130 of file include/settings/environment.h.
Referenced by GetDefinedExternally(), and SetDefinedExternally().
|
private |
Flag to indicate if the environment variable was defined in the settings file.
Definition at line 133 of file include/settings/environment.h.
Referenced by GetDefinedInSettings(), and SetDefinedInSettings().
|
private |
The environment variable string key.
Definition at line 115 of file include/settings/environment.h.
Referenced by GetKey().
|
private |
The value that was originally loaded from JSON.
Definition at line 124 of file include/settings/environment.h.
Referenced by GetSettingsValue(), and SetSettingsValue().
|
private |
The environment variable string value.
Definition at line 118 of file include/settings/environment.h.
Referenced by GetValue(), IsDefault(), and SetValue().