25#include <wx/filename.h>
26#include <wx/snglinst.h>
27#include <wx/stdpaths.h>
52 m_headless( aHeadless ),
54 m_common_settings( nullptr ),
56 m_migrateLibraryTables( true )
78 for( std::unique_ptr<JSON_SETTINGS>& settings :
m_settings )
89 std::unique_ptr<JSON_SETTINGS> ptr( aSettings );
91 ptr->SetManager(
this );
93 wxLogTrace(
traceSettings, wxT(
"Registered new settings object <%s>" ), ptr->GetFullFilename() );
116 [&aSettings](
const std::unique_ptr<JSON_SETTINGS>& aPtr )
118 return aPtr.get() == aSettings;
142 [&aSettings](
const std::unique_ptr<JSON_SETTINGS>& aPtr )
144 return aPtr.get() == aSettings;
149 wxLogTrace(
traceSettings, wxT(
"Saving %s" ), ( *it )->GetFullFilename() );
158 [&aSettings](
const std::unique_ptr<JSON_SETTINGS>& aPtr )
160 return aPtr.get() == aSettings;
165 wxLogTrace(
traceSettings, wxT(
"Flush and release %s" ), ( *it )->GetFullFilename() );
170 size_t typeHash =
typeid( *it->get() ).hash_code();
188 [&aName](
const std::pair<wxString, COLOR_SETTINGS*>& p )
190 return p.second->GetName().Lower() == aName.Lower();
221 wxLogTrace(
traceSettings, wxT(
"Attempting to load color theme %s" ), aName );
225 if( !fn.IsOk() || !fn.Exists() )
227 wxLogTrace(
traceSettings, wxT(
"Theme file %s.json not found, falling back to user" ), aName );
233 if( settings->
GetFilename() != aName.ToStdString() )
235 wxLogTrace(
traceSettings, wxT(
"Warning: stored filename is actually %s, " ),
256 wxDirTraverseResult
OnFile(
const wxString& aFilePath )
override
258 wxFileName file( aFilePath );
260 if( file.GetExt() == wxS(
"json" ) )
263 return wxDIR_CONTINUE;
266 wxDirTraverseResult
OnDir(
const wxString& dirPath )
override
268 return wxDIR_CONTINUE;
288 if( aName.EndsWith( wxT(
".json" ) ) )
300 settings->
SetName( wxT(
"User" ) );
314 wxFileName third_party_path;
316 auto it = env.find( wxS(
"KICAD7_3RD_PARTY" ) );
318 if( it != env.end() && !it->second.GetValue().IsEmpty() )
319 third_party_path.SetPath( it->second.GetValue() );
323 third_party_path.AppendDir( wxS(
"colors" ) );
325 wxDir third_party_colors_dir( third_party_path.GetFullPath() );
335 [&](
const wxFileName& aFilename )
341 wxDir colors_dir( color_settings_path );
343 if( colors_dir.IsOpened() )
345 if( third_party_colors_dir.IsOpened() )
346 third_party_colors_dir.Traverse( thirdPartyLoader );
348 colors_dir.Traverse( loader );
364 [aSettings] (
const std::pair<wxString, COLOR_SETTINGS*>& el )
366 return el.second->GetFilename() == aSettings->GetFilename();
373 if( !aSettings->
Store() )
375 wxLogTrace(
traceSettings, wxT(
"Color scheme %s not modified; skipping save" ),
380 wxASSERT( aSettings->
Contains( aNamespace ) );
382 wxLogTrace(
traceSettings, wxT(
"Saving color scheme %s, preserving %s" ),
386 std::optional<nlohmann::json> backup = aSettings->
GetJson( aNamespace );
392 ( *aSettings->
Internals() )[aNamespace].update( *backup );
402 wxASSERT( aSettings );
420 wxASSERT_MSG(
false, wxT(
"Unknown settings location!" ) );
445 wxDirTraverseResult
OnFile(
const wxString& aSrcFilePath )
override
447 wxFileName file( aSrcFilePath );
450 file.GetName() == wxT(
"fp-lib-table" ) ) )
452 return wxDIR_CONTINUE;
456 if( file.GetFullName() == wxT(
"installed_packages.json" ) )
457 return wxDIR_CONTINUE;
461 if( file.GetExt() == wxT(
"hotkeys" ) )
462 return wxDIR_CONTINUE;
464 wxString
path = file.GetPath();
467 file.SetPath(
path );
469 wxLogTrace(
traceSettings, wxT(
"Copying %s to %s" ), aSrcFilePath, file.GetFullPath() );
474 return wxDIR_CONTINUE;
477 wxDirTraverseResult
OnDir(
const wxString& dirPath )
override
479 wxFileName dir( dirPath );
482 if( dir.GetName() == wxS(
"colors" ) ||
483 dir.GetName() == wxS(
"3d" ) )
486 wxString
path = dir.GetPath();
491 wxMkdir( dir.GetFullPath() );
493 return wxDIR_CONTINUE;
506 wxLogTrace(
traceSettings, wxT(
"Using settings path %s" ),
path.GetFullPath() );
513 if( !
path.DirExists() )
515 wxLogTrace(
traceSettings, wxT(
"Path didn't exist; creating it" ) );
516 path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
519 wxLogTrace(
traceSettings, wxT(
"Settings migration not checked; running headless" ) );
523 if(
path.DirExists() )
525 wxFileName common =
path;
526 common.SetName( wxS(
"kicad_common" ) );
527 common.SetExt( wxS(
"json" ) );
529 if( common.Exists() )
531 wxLogTrace(
traceSettings, wxT(
"Path exists and has a kicad_common, continuing!" ) );
539 if( dlg.ShowModal() != wxID_OK )
541 wxLogTrace(
traceSettings, wxT(
"Migration dialog canceled; exiting" ) );
545 if( !
path.DirExists() )
547 wxLogTrace(
traceSettings, wxT(
"Path didn't exist; creating it" ) );
548 path.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL );
553 wxLogTrace(
traceSettings, wxT(
"No migration source given; starting with defaults" ) );
562 source_dir.Traverse( traverser );
574 const std::vector<wxString> libKeys = {
575 wxT(
"KICAD6_SYMBOL_DIR" ),
576 wxT(
"KICAD6_3DMODEL_DIR" ),
577 wxT(
"KICAD6_FOOTPRINT_DIR" ),
578 wxT(
"KICAD6_TEMPLATE_DIR" ),
579 wxT(
"KICAD7_SYMBOL_DIR" ),
580 wxT(
"KICAD7_3DMODEL_DIR" ),
581 wxT(
"KICAD7_FOOTPRINT_DIR" ),
582 wxT(
"KICAD7_TEMPLATE_DIR" ),
585 wxT(
"KICAD_PTEMPLATES" ),
588 wxT(
"KICAD_SYMBOL_DIR" ),
591 for(
const wxString& key : libKeys )
608 std::vector<wxFileName> base_paths;
613 if( wxGetEnv( wxT(
"KICAD_CONFIG_HOME" ),
nullptr ) )
623 wxFileName wxGtkPath;
624 wxGtkPath.AssignDir( wxS(
"~/.config/kicad" ) );
625 wxGtkPath.MakeAbsolute();
626 base_paths.emplace_back( wxGtkPath.GetPath() );
629 wxGtkPath.AssignDir( wxS(
"~/.var/app/org.kicad.KiCad/config/kicad" ) );
630 wxGtkPath.MakeAbsolute();
631 base_paths.emplace_back( wxGtkPath.GetPath() );
638 auto check_dir = [&] (
const wxString& aSubDir )
643 wxString sub_path = dir.GetNameWithSep() + aSubDir;
647 aPaths->push_back( sub_path );
648 wxLogTrace(
traceSettings, wxT(
"GetPreviousVersionName: %s is valid" ), sub_path );
653 std::set<wxString> checkedPaths;
655 for(
const wxFileName& base_path : base_paths )
657 if( checkedPaths.count( base_path.GetFullPath() ) )
660 checkedPaths.insert( base_path.GetFullPath() );
662 if( !dir.Open( base_path.GetFullPath() ) )
664 wxLogTrace(
traceSettings, wxT(
"GetPreviousVersionName: could not open base path %s" ),
665 base_path.GetFullPath() );
669 wxLogTrace(
traceSettings, wxT(
"GetPreviousVersionName: checking base path %s" ),
670 base_path.GetFullPath() );
672 if( dir.GetFirst( &subdir, wxEmptyString, wxDIR_DIRS ) )
677 while( dir.GetNext( &subdir ) )
688 wxT(
"GetPreviousVersionName: root path %s is valid" ), dir.GetName() );
689 aPaths->push_back( dir.GetName() );
693 std::sort( aPaths->begin(), aPaths->end(),
694 [&](
const wxString& a,
const wxString& b ) ->
bool
696 wxString verA = wxFileName::DirName( a ).GetDirs().back();
697 wxString verB = wxFileName::DirName( b ).GetDirs().back();
699 if( !extractVersion( verA.ToStdString() )
700 || !extractVersion( verB.ToStdString() ) )
708 return aPaths->size() > 0;
714 wxFileName
test( aPath, wxS(
"kicad_common" ) );
719 test.SetExt(
"json" );
721 return test.Exists();
730 path.AppendDir( wxS(
"colors" ) );
732 if( !
path.DirExists() )
734 if( !wxMkdir(
path.GetPath() ) )
737 wxT(
"GetColorSettingsPath(): Path %s missing and could not be created!" ),
742 return path.GetPath();
748 static wxString user_settings_path;
750 if( user_settings_path.empty() )
753 return user_settings_path;
764 if( aUseEnv && wxGetEnv( wxT(
"KICAD_CONFIG_HOME" ), &envstr ) && !envstr.IsEmpty() )
767 cfgpath.AssignDir( envstr );
773 cfgpath.AppendDir(
TO_STR( KICAD_CONFIG_DIR ) );
779 return cfgpath.GetPath();
799 wxLogTrace(
traceSettings, wxT(
"compareSettingsVersions: bad input (%s, %s)" ), aFirst, aSecond );
807 else if( a_maj > b_maj )
817 else if( a_min > b_min )
831 std::regex re_version(
"(\\d+)\\.(\\d+)" );
834 if( std::regex_match( aVersionString, match, re_version ) )
838 int major = std::stoi( match[1].str() );
839 int minor = std::stoi( match[2].str() );
862 wxFileName
path( aFullPath );
867 wxString fullPath =
path.GetFullPath();
875 bool readOnly =
false;
876 std::unique_ptr<wxSingleInstanceChecker> lockFile =
::LockFile( fullPath );
880 wxLogTrace(
traceSettings, wxT(
"Project %s is locked; opening read-only" ), fullPath );
892 [&](
const std::unique_ptr<PROJECT>& ptr )
894 return ptr.get() == oldProject;
901 wxLogTrace(
traceSettings, wxT(
"Load project %s" ), fullPath );
903 std::unique_ptr<PROJECT>
project = std::make_unique<PROJECT>();
904 project->setProjectFullName( fullPath );
910 project->SetReadOnly( readOnly ||
project->GetProjectFile().IsReadOnly() );
919 wxString fn(
path.GetName() );
928 m_projects[fullPath]->setLocalSettings( settings );
946 wxLogTrace(
traceSettings, wxT(
"Unload project %s" ), projectPath );
950 [&](
const std::unique_ptr<PROJECT>& ptr )
952 return ptr.get() == toRemove;
1003 std::vector<wxString> ret;
1005 for(
const std::pair<const wxString, PROJECT*>& pair :
m_projects )
1006 ret.emplace_back( pair.first );
1017 wxString
path = aFullPath;
1032 project->SaveToFile( projectPath );
1046 if( aFullPath.IsSameAs( oldName ) )
1055 wxFileName fn( aFullPath );
1064 project->SetFilename( fn.GetName() );
1065 project->SaveToFile( fn.GetPath() );
1084 wxString oldName =
project->GetFilename();
1085 wxFileName fn( aFullPath );
1087 bool readOnly =
project->IsReadOnly();
1088 project->SetReadOnly(
false );
1090 project->SetFilename( fn.GetName() );
1091 project->SaveToFile( fn.GetPath() );
1092 project->SetFilename( oldName );
1100 project->SetReadOnly( readOnly );
1107 wxString fn( fullFn.GetName() );
1116 wxString
path( fullFn.GetPath() );
1135 [&file](
const std::unique_ptr<JSON_SETTINGS>& aPtr )
1137 return aPtr.get() == file;
1147 ( *it )->SaveToFile( projectPath );
1169 wxDateTime timestamp = wxDateTime::Now();
1176 target.SetName( fileName );
1179 if( !target.DirExists() && !wxMkdir( target.GetPath() ) )
1181 wxLogTrace(
traceSettings, wxT(
"Could not create project backup path %s" ), target.GetPath() );
1185 if( !target.IsDirWritable() )
1187 wxLogTrace(
traceSettings, wxT(
"Backup directory %s is not writable" ), target.GetPath() );
1191 wxLogTrace(
traceSettings, wxT(
"Backing up project to %s" ), target.GetPath() );
1195 return archiver.
Archive(
Prj().GetProjectPath(), target.GetFullPath(), aReporter );
1203 std::function<
bool(
const wxString& )> aCond ) :
1209 wxDirTraverseResult
OnFile(
const wxString& aFile )
override
1212 m_files.emplace_back( aFile );
1214 return wxDIR_CONTINUE;
1217 wxDirTraverseResult
OnDir(
const wxString& aDirName )
override
1219 return wxDIR_CONTINUE;
1239 [&prefix](
const wxString& aFile )
1242 wxString fn( wxFileName( aFile ).GetName() );
1243 fn.Replace( prefix, wxS(
"" ) );
1248 wxFileName projectPath(
Prj().GetProjectPath() );
1251 if( !projectPath.IsOk() || !projectPath.Exists() || !projectPath.IsDirWritable() )
1256 if( !wxDirExists( backupPath ) )
1258 wxLogTrace(
traceSettings, wxT(
"Backup path %s doesn't exist, creating it" ), backupPath );
1260 if( !wxMkdir( backupPath ) )
1262 wxLogTrace(
traceSettings, wxT(
"Could not create backups path! Skipping backup" ) );
1267 wxDir dir( backupPath );
1269 if( !dir.IsOpened() )
1271 wxLogTrace(
traceSettings, wxT(
"Could not open project backups path %s" ), dir.GetName() );
1275 std::vector<wxString> files;
1278 [&modTime](
const wxString& aFile )
1280 return modTime( aFile ).IsValid();
1283 dir.Traverse( traverser, wxT(
"*.zip" ) );
1286 std::sort( files.begin(), files.end(),
1287 [&](
const wxString& aFirst,
const wxString& aSecond ) ->
bool
1289 wxDateTime first = modTime( aFirst );
1290 wxDateTime second = modTime( aSecond );
1292 return first.GetTicks() > second.GetTicks();
1296 if( !files.empty() )
1298 wxDateTime lastTime = modTime( files[0] );
1300 if( lastTime.IsValid() )
1302 wxTimeSpan
delta = wxDateTime::Now() - modTime( files[0] );
1316 wxRemoveFile( files.back() );
1324 wxULongLong totalSize = 0;
1326 for(
const wxString& file : files )
1327 totalSize += wxFileName::GetSize( file );
1329 while( !files.empty() && totalSize >
static_cast<wxULongLong
>( settings.
limit_total_size ) )
1331 totalSize -= wxFileName::GetSize( files.back() );
1332 wxRemoveFile( files.back() );
1340 wxDateTime day = modTime( files[0] );
1343 wxASSERT( day.IsValid() );
1345 std::vector<wxString> filesToDelete;
1347 for(
size_t i = 1; i < files.size(); i++ )
1349 wxDateTime dt = modTime( files[i] );
1351 if( dt.IsSameDate( day ) )
1356 filesToDelete.emplace_back( files[i] );
1365 for(
const wxString& file : filesToDelete )
1366 wxRemoveFile( file );
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetName(const wxString &aName)
static std::vector< COLOR_SETTINGS * > CreateBuiltinColorSettings()
Constructs and returns a list of color settings objects based on the built-in color themes.
std::function< void(const wxFileName &)> m_action
JSON_DIR_TRAVERSER(std::function< void(const wxFileName &)> aAction)
wxDirTraverseResult OnDir(const wxString &dirPath) override
wxDirTraverseResult OnFile(const wxString &aFilePath) override
std::optional< nlohmann::json > GetJson(const std::string &aPath) const
Fetches a JSON object that is a subset of this JSON_SETTINGS object, using a path of the form "key1....
bool Contains(const std::string &aPath) const
SETTINGS_LOC GetLocation() const
virtual bool LoadFromFile(const wxString &aDirectory="")
Loads the backing file from disk and then calls Load()
virtual void Load()
Updates the parameters of this object based on the current JSON document contents.
void SetReadOnly(bool aReadOnly)
JSON_SETTINGS_INTERNALS * Internals()
void SetFilename(const wxString &aFilename)
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
virtual bool Store()
Stores the current parameters into the JSON document represented by this object Note: this doesn't do...
wxString GetFilename() const
virtual void ProjectChanged()
Calls ProjectChanged() on all KIWAY_PLAYERs.
wxDirTraverseResult OnDir(const wxString &dirPath) override
MIGRATION_TRAVERSER(const wxString &aSrcDir, const wxString &aDestDir, bool aMigrateTables)
wxDirTraverseResult OnFile(const wxString &aSrcFilePath) override
static wxString GetDefault3rdPartyPath()
Gets the default path for PCM packages.
bool Archive(const wxString &aSrcDir, const wxString &aDestFile, REPORTER &aReporter, bool aVerbose=true, bool aIncludeExtraFiles=false)
Creates an archive of the project.
The backing store for a PROJECT, in JSON format.
void SetProject(PROJECT *aProject)
The project local settings are things that are attached to a particular project, but also might be pa...
bool SaveToFile(const wxString &aDirectory="", bool aForce=false) override
Container for project specific data.
virtual void setProjectFile(PROJECT_FILE *aFile)
Set the backing store file for this project.
virtual bool IsReadOnly() const
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual const wxString GetProjectName() const
Return the short name of the project.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
virtual void setProjectFullName(const wxString &aFullPathAndName)
Set the full directory, basename, and extension of the project.
A pure virtual class used to derive REPORTER objects from.
static int compareVersions(const std::string &aFirst, const std::string &aSecond)
Compares two settings versions, like "5.99" and "6.0".
wxString GetPathForSettingsFile(JSON_SETTINGS *aSettings)
Returns the path a given settings file should be loaded from / stored to.
static std::string GetSettingsVersion()
Parses the current KiCad build version and extracts the major and minor revision to use as the name o...
void SaveProjectAs(const wxString &aFullPath, PROJECT *aProject=nullptr)
Sets the currently loaded project path and saves it (pointers remain valid) Note that this will not m...
JSON_SETTINGS * registerSettings(JSON_SETTINGS *aSettings, bool aLoadNow=true)
static wxString GetUserSettingsPath()
Return the user configuration path used to store KiCad's configuration files.
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Takes ownership of the pointer passed in.
std::unique_ptr< wxSingleInstanceChecker > m_project_lock
Lock for loaded project (expand to multiple once we support MDI)
void SaveProjectCopy(const wxString &aFullPath, PROJECT *aProject=nullptr)
Saves a copy of the current project under the given path.
bool MigrateIfNeeded()
Handles the initialization of the user settings directory and migration from previous KiCad versions ...
wxString m_migration_source
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely saves a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
bool BackupProject(REPORTER &aReporter) const
Creates a backup archive of the current project.
static wxString calculateUserSettingsPath(bool aIncludeVer=true, bool aUseEnv=true)
Determines the base path for user settings files.
std::map< wxString, PROJECT * > m_projects
Loaded projects, mapped according to project full name.
static bool extractVersion(const std::string &aVersionString, int *aMajor=nullptr, int *aMinor=nullptr)
Extracts the numeric version from a given settings string.
COLOR_SETTINGS * registerColorSettings(const wxString &aFilename, bool aAbsolutePath=false)
bool m_headless
True if running outside a UI context.
SETTINGS_MANAGER(bool aHeadless=false)
static wxString GetColorSettingsPath()
Returns the path where color scheme files are stored; creating it if missing (normally .
COMMON_SETTINGS * GetCommonSettings() const
Retrieves the common settings shared by all applications.
bool SaveProject(const wxString &aFullPath=wxEmptyString, PROJECT *aProject=nullptr)
Saves a loaded project.
wxString GetProjectBackupsPath() const
bool LoadProject(const wxString &aFullPath, bool aSetActive=true)
Loads a project or sets up a new project with a specified path.
std::map< wxString, PROJECT_FILE * > m_project_files
Loaded project files, mapped according to project full name.
std::unordered_map< wxString, COLOR_SETTINGS * > m_color_settings
COLOR_SETTINGS * loadColorSettingsByName(const wxString &aName)
Attempts to load a color theme by name (the color theme directory and .json ext are assumed)
bool IsProjectOpen() const
Helper for checking if we have a project open TODO: This should be deprecated along with Prj() once w...
bool GetPreviousVersionPaths(std::vector< wxString > *aName=nullptr)
Retrieves the name of the most recent previous KiCad version that can be found in the user settings d...
static bool IsSettingsPathValid(const wxString &aPath)
Checks if a given path is probably a valid KiCad configuration directory.
std::vector< std::unique_ptr< PROJECT > > m_projects_list
Loaded projects (ownership here)
void loadAllColorSettings()
PROJECT * GetProject(const wxString &aFullPath) const
Retrieves a loaded project by name.
bool UnloadProject(PROJECT *aProject, bool aSave=true)
Saves, unloads and unregisters the given PROJECT.
std::vector< wxString > GetOpenProjects() const
std::vector< std::unique_ptr< JSON_SETTINGS > > m_settings
bool TriggerBackupIfNeeded(REPORTER &aReporter) const
Calls BackupProject if a new backup is needed according to the current backup policy.
bool m_migrateLibraryTables
If true, the symbol and footprint library tables will be migrated from the previous version.
bool unloadProjectFile(PROJECT *aProject, bool aSave)
Optionally saves, and then unloads and unregisters the given PROJECT_FILE.
COLOR_SETTINGS * GetMigratedColorSettings()
Returns a color theme for storing colors migrated from legacy (5.x and earlier) settings,...
std::unordered_map< size_t, JSON_SETTINGS * > m_app_settings_cache
Cache for app settings.
COLOR_SETTINGS * AddNewColorSettings(const wxString &aFilename)
Registers a new color settings object with the given filename.
bool m_ok
True if settings loaded successfully at construction.
PROJECT & Prj() const
A helper while we are not MDI-capable – return the one and only project.
bool loadProjectFile(PROJECT &aProject)
Registers a PROJECT_FILE and attempts to load it from disk.
static wxString backupDateTimeFormat
void ReloadColorSettings()
Re-scans the color themes directory, reloading any changes it finds.
COMMON_SETTINGS * m_common_settings
KIWAY * m_kiway
The kiway this settings manager interacts with.
void FlushAndRelease(JSON_SETTINGS *aSettings, bool aSave=true)
If the given settings object is registered, save it to disk and unregister it.
wxDirTraverseResult OnFile(const wxString &aFile) override
wxDirTraverseResult OnDir(const wxString &aDirName) override
std::vector< wxString > & m_files
VECTOR_INSERT_TRAVERSER(std::vector< wxString > &aVec, std::function< bool(const wxString &)> aCond)
std::function< bool(const wxString &)> m_condition
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
const std::string LegacyProjectFileExtension
const std::string ProjectFileExtension
const std::string ArchiveFileExtension
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
@ PROJECT
The settings directory inside a project folder.
@ USER
The main config directory (e.g. ~/.config/kicad/)
@ COLORS
The color scheme directory (e.g. ~/.config/kicad/colors/)
@ NONE
No directory prepended, full path in filename (used for PROJECT_FILE)
std::unique_ptr< wxSingleInstanceChecker > LockFile(const wxString &aFileName)
Test to see if aFileName can be locked (is not already locked) and only then returns a wxSingleInstan...
This file contains miscellaneous commonly used macros and functions.
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
#define PROJECT_BACKUPS_DIR_SUFFIX
Project settings path will be <projectname> + this.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
int min_interval
Minimum time, in seconds, between subsequent backups.
unsigned long long limit_total_size
Maximum total size of backups (bytes), 0 for unlimited.
int limit_total_files
Maximum number of backup archives to retain.
int limit_daily_files
Maximum files to keep per day, 0 for unlimited.
bool enabled
Automatically back up the project when files are saved.
Definition of file extensions used in Kicad.