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
// And forces the user to create main files under the right name for the project manager
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() )
{
wxFile file( fn.GetFullPath(), wxFile::write );
if( file.IsOpened() )
file.Write( wxT( "EESchema Schematic File Version 2\n"
"EELAYER 25 0\nEELAYER END\n$EndSCHEMATC\n" ) );
file.Write( wxT( "(kicad_sch (version 20200310) (host eeschema \"unknown\")\n"
"( page \"A4\")\n (lib_symbols)\n"
" (symbol_instances)\n)\n" ) );
// wxFile dtor will close the file
}

View File

@ -368,7 +368,9 @@ public:
// straight copy
CopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors );
}
else if( ext == "sch"
else if( ext == "kicad_sch"
|| ext == "kicad_sch-bak"
|| ext == "sch"
|| ext == "sch-bak"
|| ext == "sym"
|| ext == "lib"
@ -432,8 +434,6 @@ public:
}
/* TODO: what about these?
MacrosFileExtension;
FootprintPlaceFileExtension;
KiCadFootprintLibPathExtension;
GedaPcbFootprintLibFileExtension;
EagleFootprintLibPathExtension;