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 406 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 415 of file settings_manager.cpp.

415  :
416  m_src( aSrcDir ),
417  m_dest( aDestDir ),
418  m_migrateTables( aMigrateTables )
419  {
420  }

Member Function Documentation

◆ GetErrors()

wxString MIGRATION_TRAVERSER::GetErrors ( )
inline

Definition at line 422 of file settings_manager.cpp.

422 { return m_errors; }

References m_errors.

◆ OnDir()

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

Definition at line 456 of file settings_manager.cpp.

457  {
458  wxFileName dir( dirPath );
459 
460  // Whitelist of directories to migrate
461  if( dir.GetName() == "colors" ||
462  dir.GetName() == "3d" )
463  {
464 
465  wxString path = dir.GetPath();
466 
467  path.Replace( m_src, m_dest, false );
468  dir.SetPath( path );
469 
470  wxMkdir( dir.GetFullPath() );
471 
472  return wxDIR_CONTINUE;
473  }
474  else
475  {
476  return wxDIR_IGNORE;
477  }
478  }

References m_dest, m_src, and path.

◆ OnFile()

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

Definition at line 424 of file settings_manager.cpp.

425  {
426  wxFileName file( aSrcFilePath );
427 
428  if( !m_migrateTables && ( file.GetName() == wxT( "sym-lib-table" ) ||
429  file.GetName() == wxT( "fp-lib-table" ) ) )
430  {
431  return wxDIR_CONTINUE;
432  }
433 
434  // Skip migrating PCM installed packages as packages themselves are not moved
435  if( file.GetFullName() == wxT( "installed_packages.json" ) )
436  return wxDIR_CONTINUE;
437 
438  // Don't migrate hotkeys config files; we don't have a reasonable migration handler for them
439  // and so there is no way to resolve conflicts at the moment
440  if( file.GetExt() == wxT( "hotkeys" ) )
441  return wxDIR_CONTINUE;
442 
443  wxString path = file.GetPath();
444 
445  path.Replace( m_src, m_dest, false );
446  file.SetPath( path );
447 
448  wxLogTrace( traceSettings, "Copying %s to %s", aSrcFilePath, file.GetFullPath() );
449 
450  // For now, just copy everything
451  KiCopyFile( aSrcFilePath, file.GetFullPath(), m_errors );
452 
453  return wxDIR_CONTINUE;
454  }
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 410 of file settings_manager.cpp.

Referenced by OnDir(), and OnFile().

◆ m_errors

wxString MIGRATION_TRAVERSER::m_errors
private

Definition at line 411 of file settings_manager.cpp.

Referenced by GetErrors(), and OnFile().

◆ m_migrateTables

bool MIGRATION_TRAVERSER::m_migrateTables
private

Definition at line 412 of file settings_manager.cpp.

Referenced by OnFile().

◆ m_src

wxString MIGRATION_TRAVERSER::m_src
private

Definition at line 409 of file settings_manager.cpp.

Referenced by OnDir(), and OnFile().


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