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 <kicommon.h>
24#include <wx/filename.h>
25#include <wx/string.h>
26
30#define UNIX_STRING_DIR_SEP wxT( "/" )
31#define WIN_STRING_DIR_SEP wxT( "\\" )
32
33
34// lowercase or pretty case depending on platform
35#if defined( __WXMAC__ ) || defined( __WXMSW__ )
36#define KICAD_PATH_STR wxT( "KiCad" )
37#else
38#define KICAD_PATH_STR wxT( "kicad" )
39#endif
40
45{
46public:
47
51 static wxString GetUserScriptingPath();
52
56 static wxString GetUserTemplatesPath();
57
61 static wxString GetUserPluginsPath();
62
66 static wxString GetDefaultUserProjectsPath();
67
71 static wxString GetDefaultUserSymbolsPath();
72
76 static wxString GetDefaultUserFootprintsPath();
77
81 static wxString GetDefaultUserDesignBlocksPath();
82
86 static wxString GetDefaultUser3DModelsPath();
87
91 static wxString GetStockDataPath( bool aRespectRunFromBuildDir = true );
92
97 static wxString GetStockEDALibraryPath();
98
102 static wxString GetDefault3rdPartyPath();
103
107 static wxString GetStockSymbolsPath();
108
112 static wxString GetStockFootprintsPath();
113
117 static wxString GetStockDesignBlocksPath();
118
122 static wxString GetStock3dmodelsPath();
123
127 static wxString GetStockScriptingPath();
128
132 static wxString GetStockPluginsPath();
133
137 static wxString GetStockPlugins3DPath();
138
142 static wxString GetStockDemosPath();
143
147 static wxString GetStockTemplatesPath();
148
152 static wxString GetLocaleDataPath();
153
157 static wxString GetUserCachePath();
158
162 static wxString GetDocumentationPath();
163
167 static wxString GetLogsPath();
168
172 static bool EnsurePathExists( const wxString& aPath, bool aPathToFile = false );
173
177 static void EnsureUserPathsExist();
178
179#ifdef __WXMAC__
185 static wxString GetOSXKicadUserDataDir();
186
190 static wxString GetOSXKicadMachineDataDir();
191
195 static wxString GetOSXKicadDataDir();
196#endif
197
198#ifdef _WIN32
202 static wxString GetWindowsFontConfigDir();
203
204
208 static wxString GetWindowsBaseSharePath();
209#endif
210
220 static wxString GetUserSettingsPath();
221
236 static wxString CalculateUserSettingsPath( bool aIncludeVer = true, bool aUseEnv = true );
237
238 static const wxString& GetExecutablePath();
239
248 static wxString ResolveSiblingExecutable( const wxString& aBaseName );
249
253 static wxString FindKiCadBuildRoot( const wxString& aExecutablePath );
254
258 static const wxString& GetBuildRoot();
259
263 static bool RunningFromBuildDir();
264
265private:
266 // we are a static helper
267 PATHS() {}
268
274 static void getUserDocumentPath( wxFileName& aPath );
275
276#ifdef _WIN32
282 static wxString getWindowsKiCadRoot();
283#endif
284};
285
286#endif
static bool RunningFromBuildDir()
True when KiCad runs from its build tree or KICAD_RUN_FROM_BUILD_DIR is set.
Definition paths.cpp:698
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:669
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 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:690
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:704
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:267
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