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 407 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 416 of file settings_manager.cpp.

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

Member Function Documentation

◆ GetErrors()

wxString MIGRATION_TRAVERSER::GetErrors ( )
inline

Definition at line 423 of file settings_manager.cpp.

423 { return m_errors; }

References m_errors.

◆ OnDir()

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

Definition at line 457 of file settings_manager.cpp.

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

References m_dest, m_src, and path.

◆ OnFile()

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

Definition at line 425 of file settings_manager.cpp.

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

Referenced by OnDir(), and OnFile().

◆ m_errors

wxString MIGRATION_TRAVERSER::m_errors
private

Definition at line 412 of file settings_manager.cpp.

Referenced by GetErrors(), and OnFile().

◆ m_migrateTables

bool MIGRATION_TRAVERSER::m_migrateTables
private

Definition at line 413 of file settings_manager.cpp.

Referenced by OnFile().

◆ m_src

wxString MIGRATION_TRAVERSER::m_src
private

Definition at line 410 of file settings_manager.cpp.

Referenced by OnDir(), and OnFile().


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