KiCad PCB EDA Suite
Loading...
Searching...
No Matches
PATHS Class Reference

Helper class to centralize the paths used throughout kicad. More...

#include <paths.h>

Static Public Member Functions

static wxString GetUserScriptingPath ()
 Gets the user path for python scripts. More...
 
static wxString GetUserTemplatesPath ()
 Gets the user path for custom templates. More...
 
static wxString GetUserPluginsPath ()
 Gets the user path for plugins. More...
 
static wxString GetUserPlugins3DPath ()
 Gets the user path for 3d viewer plugin. More...
 
static wxString GetDefaultUserProjectsPath ()
 Gets the default path we point users to create projects. More...
 
static wxString GetDefaultUserSymbolsPath ()
 Gets the default path we point users to create projects. More...
 
static wxString GetDefaultUserFootprintsPath ()
 Gets the default path we point users to create projects. More...
 
static wxString GetDefaultUser3DModelsPath ()
 Gets the default path we point users to create projects. More...
 
static wxString GetStockDataPath (bool aRespectRunFromBuildDir=true)
 Gets the stock (install) data path, which is the base path for things like scripting, etc. More...
 
static wxString GetStockEDALibraryPath ()
 Gets the stock (install) EDA library data path, which is the base path for templates, schematic symbols, footprints, and 3D models. More...
 
static wxString GetDefault3rdPartyPath ()
 Gets the default path for PCM packages. More...
 
static wxString GetStockSymbolsPath ()
 Gets the stock (install) symbols path. More...
 
static wxString GetStockFootprintsPath ()
 Gets the stock (install) footprints path. More...
 
static wxString GetStock3dmodelsPath ()
 Gets the stock (install) 3dmodels path. More...
 
static wxString GetStockScriptingPath ()
 Gets the stock (install) scripting path. More...
 
static wxString GetStockPluginsPath ()
 Gets the stock (install) plugins path. More...
 
static wxString GetStockPlugins3DPath ()
 Gets the stock (install) 3d viewer plugins path. More...
 
static wxString GetStockDemosPath ()
 Gets the stock (install) demos path. More...
 
static wxString GetStockTemplatesPath ()
 Gets the stock (install) templates path. More...
 
static wxString GetLocaleDataPath ()
 Gets the locales translation data path. More...
 
static wxString GetUserCachePath ()
 Gets the stock (install) 3d viewer plugins path. More...
 
static wxString GetDocumentationPath ()
 Gets the documentation path, which is the base path for help files. More...
 
static wxString GetInstanceCheckerPath ()
 Gets the path used for wxSingleInstanceChecker lock files. More...
 
static bool EnsurePathExists (const wxString &aPath)
 Attempts to create a given path if it does not exist. More...
 
static void EnsureUserPathsExist ()
 Ensures/creates user default paths. More...
 
static wxString GetUserSettingsPath ()
 Return the user configuration path used to store KiCad's configuration files. More...
 
static wxString CalculateUserSettingsPath (bool aIncludeVer=true, bool aUseEnv=true)
 Determines the base path for user settings files. More...
 
static const wxString & GetExecutablePath ()
 

Private Member Functions

 PATHS ()
 

Static Private Member Functions

static void getUserDocumentPath (wxFileName &aPath)
 Gets the user path for the current kicad version which acts as the root for other user paths. More...
 

Detailed Description

Helper class to centralize the paths used throughout kicad.

Definition at line 36 of file paths.h.

Constructor & Destructor Documentation

◆ PATHS()

PATHS::PATHS ( )
inlineprivate

Definition at line 228 of file paths.h.

Member Function Documentation

◆ CalculateUserSettingsPath()

wxString PATHS::CalculateUserSettingsPath ( bool  aIncludeVer = true,
bool  aUseEnv = true 
)
static

Determines the base path for user settings files.

The configuration path order of precedence is determined by the following criteria:

  • The value of the KICAD_CONFIG_HOME environment variable
  • The value of the XDG_CONFIG_HOME environment variable.
  • The result of the call to wxStandardPaths::GetUserConfigDir() with ".config" appended as required on Linux builds.
Parameters
aIncludeVerwill append the current KiCad version if true (default)
aUseEnvwill prefer the base path found in the KICAD_CONFIG_DIR if found (default)
Returns
A string containing the config path for Kicad

Definition at line 521 of file paths.cpp.

References GetMajorMinorVersion(), KIPLATFORM::ENV::GetUserConfigPath(), and TO_STR.

Referenced by SETTINGS_MANAGER::GetPreviousVersionPaths(), and GetUserSettingsPath().

◆ EnsurePathExists()

bool PATHS::EnsurePathExists ( const wxString &  aPath)
static

Attempts to create a given path if it does not exist.

Definition at line 402 of file paths.cpp.

References path.

Referenced by EnsureUserPathsExist(), and PGM_BASE::InitPgm().

◆ EnsureUserPathsExist()

◆ GetDefault3rdPartyPath()

wxString PATHS::GetDefault3rdPartyPath ( )
static

◆ GetDefaultUser3DModelsPath()

wxString PATHS::GetDefaultUser3DModelsPath ( )
static

Gets the default path we point users to create projects.

Definition at line 120 of file paths.cpp.

References getUserDocumentPath().

Referenced by EnsureUserPathsExist().

◆ GetDefaultUserFootprintsPath()

wxString PATHS::GetDefaultUserFootprintsPath ( )
static

Gets the default path we point users to create projects.

Definition at line 109 of file paths.cpp.

References getUserDocumentPath().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), PCB_BASE_EDIT_FRAME::createNewLibrary(), EnsureUserPathsExist(), and PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE().

◆ GetDefaultUserProjectsPath()

◆ GetDefaultUserSymbolsPath()

wxString PATHS::GetDefaultUserSymbolsPath ( )
static

Gets the default path we point users to create projects.

Definition at line 98 of file paths.cpp.

References getUserDocumentPath().

Referenced by SYMBOL_EDIT_FRAME::AddLibraryFile(), EnsureUserPathsExist(), SCH_EDITOR_CONTROL::ExportSymbolsToLibrary(), and PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE().

◆ GetDocumentationPath()

wxString PATHS::GetDocumentationPath ( )
static

Gets the documentation path, which is the base path for help files.

Definition at line 376 of file paths.cpp.

References path.

Referenced by SearchHelpFileFullPath().

◆ GetExecutablePath()

const wxString & PATHS::GetExecutablePath ( )
static

◆ GetInstanceCheckerPath()

wxString PATHS::GetInstanceCheckerPath ( )
static

Gets the path used for wxSingleInstanceChecker lock files.

Definition at line 392 of file paths.cpp.

References path.

Referenced by PGM_BASE::InitPgm().

◆ GetLocaleDataPath()

wxString PATHS::GetLocaleDataPath ( )
static

Gets the locales translation data path.

Definition at line 268 of file paths.cpp.

References GetStockDataPath(), and path.

Referenced by PGM_BASE::SetLanguagePath().

◆ GetStock3dmodelsPath()

wxString PATHS::GetStock3dmodelsPath ( )
static

Gets the stock (install) 3dmodels path.

Definition at line 238 of file paths.cpp.

References GetStockEDALibraryPath(), and path.

◆ GetStockDataPath()

wxString PATHS::GetStockDataPath ( bool  aRespectRunFromBuildDir = true)
static

◆ GetStockDemosPath()

wxString PATHS::GetStockDemosPath ( )
static

Gets the stock (install) demos path.

Definition at line 344 of file paths.cpp.

References GetStockDataPath().

Referenced by KICAD_MANAGER_FRAME::doReCreateMenuBar(), and KICAD_MANAGER_CONTROL::OpenDemoProject().

◆ GetStockEDALibraryPath()

wxString PATHS::GetStockEDALibraryPath ( )
static

Gets the stock (install) EDA library data path, which is the base path for templates, schematic symbols, footprints, and 3D models.

Definition at line 202 of file paths.cpp.

References GetStockDataPath(), and path.

Referenced by GetStock3dmodelsPath(), GetStockFootprintsPath(), GetStockSymbolsPath(), GetStockTemplatesPath(), COMMON_SETTINGS::InitializeEnvironment(), and SystemDirsAppend().

◆ GetStockFootprintsPath()

wxString PATHS::GetStockFootprintsPath ( )
static

Gets the stock (install) footprints path.

Definition at line 228 of file paths.cpp.

References GetStockEDALibraryPath(), and path.

◆ GetStockPlugins3DPath()

wxString PATHS::GetStockPlugins3DPath ( )
static

Gets the stock (install) 3d viewer plugins path.

Definition at line 294 of file paths.cpp.

References GetExecutablePath().

Referenced by S3D_PLUGIN_MANAGER::loadPlugins().

◆ GetStockPluginsPath()

wxString PATHS::GetStockPluginsPath ( )
static

Gets the stock (install) plugins path.

Definition at line 278 of file paths.cpp.

References GetExecutablePath(), and GetStockDataPath().

Referenced by BOM_GENERATOR_HANDLER::FindFilePath(), and DIALOG_BOM::pluginInit().

◆ GetStockScriptingPath()

wxString PATHS::GetStockScriptingPath ( )
static

Gets the stock (install) scripting path.

Definition at line 248 of file paths.cpp.

References GetStockDataPath(), and path.

◆ GetStockSymbolsPath()

wxString PATHS::GetStockSymbolsPath ( )
static

Gets the stock (install) symbols path.

Definition at line 218 of file paths.cpp.

References GetStockEDALibraryPath(), and path.

◆ GetStockTemplatesPath()

wxString PATHS::GetStockTemplatesPath ( )
static

Gets the stock (install) templates path.

Definition at line 258 of file paths.cpp.

References GetStockEDALibraryPath(), and path.

Referenced by COMMON_SETTINGS::InitializeEnvironment().

◆ GetUserCachePath()

◆ getUserDocumentPath()

void PATHS::getUserDocumentPath ( wxFileName &  aPath)
staticprivate

Gets the user path for the current kicad version which acts as the root for other user paths.

Parameters
aPathVariable to receive the path

Definition at line 40 of file paths.cpp.

References KIPLATFORM::ENV::GetDocumentsPath(), GetMajorMinorVersion(), and KICAD_PATH_STR.

Referenced by GetDefault3rdPartyPath(), GetDefaultUser3DModelsPath(), GetDefaultUserFootprintsPath(), GetDefaultUserProjectsPath(), GetDefaultUserSymbolsPath(), GetUserPluginsPath(), GetUserScriptingPath(), and GetUserTemplatesPath().

◆ GetUserPlugins3DPath()

wxString PATHS::GetUserPlugins3DPath ( )
static

Gets the user path for 3d viewer plugin.

Definition at line 65 of file paths.cpp.

References GetUserPluginsPath().

◆ GetUserPluginsPath()

wxString PATHS::GetUserPluginsPath ( )
static

◆ GetUserScriptingPath()

wxString PATHS::GetUserScriptingPath ( )
static

Gets the user path for python scripts.

Definition at line 76 of file paths.cpp.

References getUserDocumentPath().

Referenced by EnsureUserPathsExist().

◆ GetUserSettingsPath()

wxString PATHS::GetUserSettingsPath ( )
static

◆ GetUserTemplatesPath()

wxString PATHS::GetUserTemplatesPath ( )
static

Gets the user path for custom templates.

Definition at line 87 of file paths.cpp.

References getUserDocumentPath().

Referenced by EnsureUserPathsExist(), PL_EDITOR_FRAME::Files_io(), COMMON_SETTINGS::InitializeEnvironment(), and PGM_KICAD::OnPgmInit().


The documentation for this class was generated from the following files: