From ba1a2aceaa1db68ced9d34a943545c54cf07ce09 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 9 May 2020 13:02:16 +0200 Subject: [PATCH] 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 --- kicad/kicad_manager_frame.cpp | 10 ++++++---- kicad/tools/kicad_manager_control.cpp | 16 ++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp index 411fcce721..36f8889aba 100644 --- a/kicad/kicad_manager_frame.cpp +++ b/kicad/kicad_manager_frame.cpp @@ -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 .sch file does not exist, create a "stub" file ( minimal schematic file ) + // If a .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 } diff --git a/kicad/tools/kicad_manager_control.cpp b/kicad/tools/kicad_manager_control.cpp index fdb1b5d52c..3893831700 100644 --- a/kicad/tools/kicad_manager_control.cpp +++ b/kicad/tools/kicad_manager_control.cpp @@ -368,12 +368,14 @@ public: // straight copy CopyFile( aSrcFilePath, destFile.GetFullPath(), m_errors ); } - else if( ext == "sch" - || ext == "sch-bak" - || ext == "sym" - || ext == "lib" - || ext == "net" - || destFile.GetName() == "sym-lib-table" ) + else if( ext == "kicad_sch" + || ext == "kicad_sch-bak" + || ext == "sch" + || ext == "sch-bak" + || ext == "sym" + || ext == "lib" + || ext == "net" + || destFile.GetName() == "sym-lib-table" ) { KIFACE* eeschema = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH ); eeschema->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath, @@ -432,8 +434,6 @@ public: } /* TODO: what about these? - MacrosFileExtension; - FootprintPlaceFileExtension; KiCadFootprintLibPathExtension; GedaPcbFootprintLibFileExtension; EagleFootprintLibPathExtension;