diff --git a/common/env_vars.cpp b/common/env_vars.cpp index 481c2701b2..cc6d502a9c 100644 --- a/common/env_vars.cpp +++ b/common/env_vars.cpp @@ -41,6 +41,7 @@ static const ENV_VAR::ENV_VAR_LIST predefinedEnvVars = { "KICAD6_TEMPLATE_DIR", "KICAD_USER_TEMPLATE_DIR", "KICAD_PTEMPLATES", + "KICAD6_3RD_PARTY", }; @@ -78,6 +79,9 @@ static void initialiseEnvVarHelp( STRING_MAP& aMap ) aMap["KICAD_USER_TEMPLATE_DIR"] = _( "Optional. Can be defined if you want to create your own project " "templates folder."); + aMap["KICAD6_3RD_PARTY"] = + _( "A directory containing 3rd party plugins, libraries and other " + "downloadable content."); aMap["KIPRJMOD"] = _("Internally defined by KiCad (cannot be edited) and is set " "to the absolute path of the currently loaded project file. This environment " diff --git a/common/paths.cpp b/common/paths.cpp index 5a7c8d93aa..b32183f17a 100644 --- a/common/paths.cpp +++ b/common/paths.cpp @@ -126,6 +126,15 @@ wxString PATHS::GetDefaultUser3DModelsPath() return tmp.GetPath(); } +wxString PATHS::GetDefault3rdPartyPath() +{ + wxFileName tmp; + getUserDocumentPath( tmp ); + + tmp.AppendDir( "3rdparty" ); + + return tmp.GetPath(); +} wxString PATHS::GetDefaultUserProjectsPath() { @@ -309,6 +318,7 @@ void PATHS::EnsureUserPathsExist() EnsurePathExists( GetDefaultUserSymbolsPath() ); EnsurePathExists( GetDefaultUserFootprintsPath() ); EnsurePathExists( GetDefaultUser3DModelsPath() ); + EnsurePathExists( GetDefault3rdPartyPath() ); } diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index 6b60237cad..269bb47b8d 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -522,6 +522,8 @@ void COMMON_SETTINGS::InitializeEnvironment() addVar( wxT( "KICAD_USER_TEMPLATE_DIR" ), PATHS::GetUserTemplatesPath() ); + addVar( wxT( "KICAD6_3RD_PARTY" ), PATHS::GetDefault3rdPartyPath() ); + path = basePath; path.AppendDir( wxT( "library" ) ); addVar( wxT( "KICAD6_SYMBOL_DIR" ), path.GetFullPath() ); diff --git a/include/paths.h b/include/paths.h index 9debe43c7d..9c23e96741 100644 --- a/include/paths.h +++ b/include/paths.h @@ -81,6 +81,11 @@ public: */ static wxString GetStockEDALibraryPath(); + /** + * Gets the default path for PCM packages + */ + static wxString GetDefault3rdPartyPath(); + /** * Gets the stock (install) scripting path */