KiCad PCB EDA Suite
Loading...
Searching...
No Matches
paths.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef PATHS_H
21#define PATHS_H
22
23#include <vector>
24
25#include <kicommon.h>
26#include <wx/filename.h>
27#include <wx/string.h>
28
32#define UNIX_STRING_DIR_SEP wxT( "/" )
33#define WIN_STRING_DIR_SEP wxT( "\\" )
34
35
36// lowercase or pretty case depending on platform
37#if defined( __WXMAC__ ) || defined( __WXMSW__ )
38#define KICAD_PATH_STR wxT( "KiCad" )
39#else
40#define KICAD_PATH_STR wxT( "kicad" )
41#endif
42
47{
48public:
49
53 static wxString GetUserScriptingPath();
54
58 static wxString GetUserTemplatesPath();
59
63 static wxString GetUserPluginsPath();
64
68 static wxString GetDefaultUserProjectsPath();
69
73 static wxString GetDefaultUserSymbolsPath();
74
78 static wxString GetDefaultUserFootprintsPath();
79
83 static wxString GetDefaultUserDesignBlocksPath();
84
88 static wxString GetDefaultUser3DModelsPath();
89
93 static wxString GetStockDataPath( bool aRespectRunFromBuildDir = true );
94
99 static wxString GetStockEDALibraryPath();
100
104 static wxString GetDefault3rdPartyPath();
105
109 static wxString GetStockSymbolsPath();
110
114 static wxString GetStockFootprintsPath();
115
119 static wxString GetStockDesignBlocksPath();
120
124 static wxString GetStock3dmodelsPath();
125
129 static wxString GetStockScriptingPath();
130
134 static wxString GetStockPluginsPath();
135
139 static wxString GetStockPlugins3DPath();
140
144 static wxString GetStockDemosPath();
145
149 static wxString GetStockTemplatesPath();
150
154 static wxString GetLocaleDataPath();
155
159 static wxString GetUserCachePath();
160
164 static wxString GetDocumentationPath();
165
169 static wxString GetLogsPath();
170
174 static bool EnsurePathExists( const wxString& aPath, bool aPathToFile = false );
175
179 static void EnsureUserPathsExist();
180
181#ifdef __WXMAC__
187 static wxString GetOSXKicadUserDataDir();
188
192 static wxString GetOSXKicadMachineDataDir();
193
197 static wxString GetOSXKicadDataDir();
198#endif
199
200#ifdef _WIN32
204 static wxString GetWindowsFontConfigDir();
205
206
210 static wxString GetWindowsBaseSharePath();
211#endif
212
222 static wxString GetUserSettingsPath();
223
238 static wxString CalculateUserSettingsPath( bool aIncludeVer = true, bool aUseEnv = true );
239
240 static const wxString& GetExecutablePath();
241
250 static wxString ResolveSiblingExecutable( const wxString& aBaseName );
251
255 static wxString FindKiCadBuildRoot( const wxString& aExecutablePath );
256
260 static const wxString& GetBuildRoot();
261
265 static bool RunningFromBuildDir();
266
274 static wxString GetExecutableDir();
275
284 static std::vector<wxString> GetToolDirectories( const wxString& aExecutableDir );
285
286private:
287 // we are a static helper
288 PATHS() {}
289
295 static void getUserDocumentPath( wxFileName& aPath );
296
297#ifdef _WIN32
303 static wxString getWindowsKiCadRoot();
304#endif
305};
306
307#endif
static bool RunningFromBuildDir()
True when KiCad runs from its build tree or KICAD_RUN_FROM_BUILD_DIR is set.
Definition paths.cpp:743
static wxString GetUserPluginsPath()
Gets the user path for plugins.
Definition paths.cpp:49
static wxString GetStockSymbolsPath()
Gets the stock (install) symbols path.
Definition paths.cpp:262
static wxString ResolveSiblingExecutable(const wxString &aBaseName)
Resolve a sibling executable alongside the running process.
Definition paths.cpp:714
static wxString GetDefaultUser3DModelsPath()
Gets the default path we point users to create projects.
Definition paths.cpp:115
static wxString GetUserTemplatesPath()
Gets the user path for custom templates.
Definition paths.cpp:71
static wxString GetStockEDALibraryPath()
Gets the stock (install) EDA library data path, which is the base path for templates,...
Definition paths.cpp:243
static wxString CalculateUserSettingsPath(bool aIncludeVer=true, bool aUseEnv=true)
Determines the base path for user settings files.
Definition paths.cpp:597
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
Definition paths.cpp:137
static std::vector< wxString > GetToolDirectories(const wxString &aExecutableDir)
Return the directories holding tools shipped alongside KiCad, most specific first.
Definition paths.cpp:689
static wxString GetStockPluginsPath()
Gets the stock (install) plugins path.
Definition paths.cpp:339
static wxString GetLogsPath()
Gets a path to use for user-visible log files.
Definition paths.cpp:459
static void EnsureUserPathsExist()
Ensures/creates user default paths.
Definition paths.cpp:497
static wxString GetDocumentationPath()
Gets the documentation path, which is the base path for help files.
Definition paths.cpp:443
static wxString GetDefaultUserDesignBlocksPath()
Gets the default path we point users to create projects.
Definition paths.cpp:104
static wxString GetDefault3rdPartyPath()
Gets the default path for PCM packages.
Definition paths.cpp:126
static const wxString & GetBuildRoot()
The build root of the running executable, or empty outside a KiCad build tree.
Definition paths.cpp:735
static wxString GetExecutableDir()
Return the directory holding the running executable itself.
Definition paths.cpp:669
static bool EnsurePathExists(const wxString &aPath, bool aPathToFile=false)
Attempts to create a given path if it does not exist.
Definition paths.cpp:470
static wxString GetStockPlugins3DPath()
Gets the stock (install) 3d viewer plugins path.
Definition paths.cpp:355
static wxString FindKiCadBuildRoot(const wxString &aExecutablePath)
Return the CMake build root for a KiCad executable path, or an empty string outside a build tree.
Definition paths.cpp:749
static wxString GetStockDataPath(bool aRespectRunFromBuildDir=true)
Gets the stock (install) data path, which is the base path for things like scripting,...
Definition paths.cpp:192
static wxString GetDefaultUserFootprintsPath()
Gets the default path we point users to create projects.
Definition paths.cpp:93
static wxString GetStock3dmodelsPath()
Gets the stock (install) 3dmodels path.
Definition paths.cpp:295
static wxString GetStockTemplatesPath()
Gets the stock (install) templates path.
Definition paths.cpp:317
static wxString GetUserCachePath()
Gets the stock (install) 3d viewer plugins path.
Definition paths.cpp:422
static wxString GetUserScriptingPath()
Gets the user path for python scripts.
Definition paths.cpp:60
static wxString GetDefaultUserSymbolsPath()
Gets the default path we point users to create projects.
Definition paths.cpp:82
static wxString GetStockDemosPath()
Gets the stock (install) demos path.
Definition paths.cpp:411
static wxString GetLocaleDataPath()
Gets the locales translation data path.
Definition paths.cpp:328
PATHS()
Definition paths.h:288
static wxString GetUserSettingsPath()
Return the user configuration path used to store KiCad's configuration files.
Definition paths.cpp:586
static wxString GetStockDesignBlocksPath()
Gets the stock (install) footprints path.
Definition paths.cpp:284
static wxString GetStockFootprintsPath()
Gets the stock (install) footprints path.
Definition paths.cpp:273
static const wxString & GetExecutablePath()
Definition paths.cpp:623
static wxString GetStockScriptingPath()
Gets the stock (install) scripting path.
Definition paths.cpp:306
#define KICOMMON_API
Definition kicommon.h:27