kicad manager: fix some issues related to new filenames extensions.

(in new project creation and save project as)

Fixes #4380
https://gitlab.com/kicad/code/kicad/issues/4380
This commit is contained in:
jean-pierre charras 2020-05-09 13:02:16 +02:00
parent acdfeee942
commit ba1a2aceaa
2 changed files with 14 additions and 12 deletions

View File

@ -411,16 +411,18 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName )
// It will avoid messages from the schematic editor or the board editor to create a new file // It will avoid messages from the schematic editor or the board editor to create a new file
// And forces the user to create main files under the right name for the project manager // And forces the user to create main files under the right name for the project manager
wxFileName fn( aProjectFileName.GetFullPath() ); wxFileName fn( aProjectFileName.GetFullPath() );
fn.SetExt( LegacySchematicFileExtension ); fn.SetExt( KiCadSchematicFileExtension );
// If a <project>.sch file does not exist, create a "stub" file ( minimal schematic file ) // If a <project>.kicad_sch file does not exist, create a "stub" file ( minimal schematic file )
if( !fn.FileExists() ) if( !fn.FileExists() )
{ {
wxFile file( fn.GetFullPath(), wxFile::write ); wxFile file( fn.GetFullPath(), wxFile::write );
if( file.IsOpened() ) if( file.IsOpened() )
file.Write( wxT( "EESchema Schematic File Version 2\n" file.Write( wxT( "(kicad_sch (version 20200310) (host eeschema \"unknown\")\n"
"EELAYER 25 0\nEELAYER END\n$EndSCHEMATC\n" ) ); "( page \"A4\")\n (lib_symbols)\n"
" (symbol_instances)\n)\n" ) );
// wxFile dtor will close the file // wxFile dtor will close the file
} }

View File

@ -368,12 +368,14 @@ public:
// straight copy // straight copy
CopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors ); CopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
} }
else if( ext == "sch" else if( ext == "kicad_sch"
|| ext == "sch-bak" || ext == "kicad_sch-bak"
|| ext == "sym" || ext == "sch"
|| ext == "lib" || ext == "sch-bak"
|| ext == "net" || ext == "sym"
|| destFile.GetName() == "sym-lib-table" ) || ext == "lib"
|| ext == "net"
|| destFile.GetName() == "sym-lib-table" )
{ {
KIFACE* eeschema = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH ); KIFACE* eeschema = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH );
eeschema->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath, eeschema->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
@ -432,8 +434,6 @@ public:
} }
/* TODO: what about these? /* TODO: what about these?
MacrosFileExtension;
FootprintPlaceFileExtension;
KiCadFootprintLibPathExtension; KiCadFootprintLibPathExtension;
GedaPcbFootprintLibFileExtension; GedaPcbFootprintLibFileExtension;
EagleFootprintLibPathExtension; EagleFootprintLibPathExtension;