KiCad PCB EDA Suite
MIGRATION_TRAVERSER Class Reference
Inheritance diagram for MIGRATION_TRAVERSER:

Public Member Functions

 MIGRATION_TRAVERSER (const wxString &aSrcDir, const wxString &aDestDir, bool aMigrateTables)
 
wxString GetErrors ()
 
wxDirTraverseResult OnFile (const wxString &aSrcFilePath) override
 
wxDirTraverseResult OnDir (const wxString &dirPath) override
 

Private Attributes

wxString m_src
 
wxString m_dest
 
wxString m_errors
 
bool m_migrateTables
 

Detailed Description

Definition at line 413 of file settings_manager.cpp.

Constructor & Destructor Documentation

◆ MIGRATION_TRAVERSER()

MIGRATION_TRAVERSER::MIGRATION_TRAVERSER ( const wxString &  aSrcDir,
const wxString &  aDestDir,
bool  aMigrateTables 
)
inline

Definition at line 422 of file settings_manager.cpp.

422 :
423 m_src( aSrcDir ),
424 m_dest( aDestDir ),
425 m_migrateTables( aMigrateTables )
426 {
427 }

Member Function Documentation

◆ GetErrors()

wxString MIGRATION_TRAVERSER::GetErrors ( )
inline

Definition at line 429 of file settings_manager.cpp.

429{ return m_errors; }

References m_errors.

Referenced by SETTINGS_MANAGER::MigrateIfNeeded().

◆ OnDir()

wxDirTraverseResult MIGRATION_TRAVERSER::OnDir ( const wxString &  dirPath)
inlineoverride

Definition at line 463 of file settings_manager.cpp.

464 {
465 wxFileName dir( dirPath );
466
467 // Whitelist of directories to migrate
468 if( dir.GetName() == "colors" ||
469 dir.GetName() == "3d" )
470 {
471
472 wxString path = dir.GetPath();
473
474 path.Replace( m_src, m_dest, false );
475 dir.SetPath( path );
476
477 wxMkdir( dir.GetFullPath() );
478
479 return wxDIR_CONTINUE;
480 }
481 else
482 {
483 return wxDIR_IGNORE;
484 }
485 }

References m_dest, m_src, and path.

◆ OnFile()

wxDirTraverseResult MIGRATION_TRAVERSER::OnFile ( const wxString &  aSrcFilePath)
inlineoverride

Definition at line 431 of file settings_manager.cpp.

432 {
433 wxFileName file( aSrcFilePath );
434
435 if( !m_migrateTables && ( file.GetName() == wxT( "sym-lib-table" ) ||
436 file.GetName() == wxT( "fp-lib-table" ) ) )
437 {
438 return wxDIR_CONTINUE;
439 }
440
441 // Skip migrating PCM installed packages as packages themselves are not moved
442 if( file.GetFullName() == wxT( "installed_packages.json" ) )
443 return wxDIR_CONTINUE;
444
445 // Don't migrate hotkeys config files; we don't have a reasonable migration handler for them
446 // and so there is no way to resolve conflicts at the moment
447 if( file.GetExt() == wxT( "hotkeys" ) )
448 return wxDIR_CONTINUE;
449
450 wxString path = file.GetPath();
451
452 path.Replace( m_src, m_dest, false );
453 file.SetPath( path );
454
455 wxLogTrace( traceSettings, wxT( "Copying %s to %s" ), aSrcFilePath, file.GetFullPath() );
456
457 // For now, just copy everything
458 KiCopyFile( aSrcFilePath, file.GetFullPath(), m_errors );
459
460 return wxDIR_CONTINUE;
461 }
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
Definition: gestfich.cpp:214
const wxChar *const traceSettings
Flag to enable debug output of settings operations and management.

References KiCopyFile(), m_dest, m_errors, m_migrateTables, m_src, path, and traceSettings.

Member Data Documentation

◆ m_dest

wxString MIGRATION_TRAVERSER::m_dest
private

Definition at line 417 of file settings_manager.cpp.

Referenced by OnDir(), and OnFile().

◆ m_errors

wxString MIGRATION_TRAVERSER::m_errors
private

Definition at line 418 of file settings_manager.cpp.

Referenced by GetErrors(), and OnFile().

◆ m_migrateTables

bool MIGRATION_TRAVERSER::m_migrateTables
private

Definition at line 419 of file settings_manager.cpp.

Referenced by OnFile().

◆ m_src

wxString MIGRATION_TRAVERSER::m_src
private

Definition at line 416 of file settings_manager.cpp.

Referenced by OnDir(), and OnFile().


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