7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

Design block extension fixups

Change design block file ext to kicad_block[s]

Fully include design blocks in project archives

schematic design blocks are a .kicad_blocks folder (library), containing
a .kicad_block folder (block), containing a .kicad_sch file (schematic
fragment) and a .json file (metadata). The .kicad_sch file is already
covered in the archived extension list, but the json needs to be
included.

As a side effect, this will pick up any other json file in the project
directory.

Also archive design block library tables
This commit is contained in:
Graham Keeth 2024-12-24 00:33:59 +00:00 committed by Seth Hillbrand
parent 3fa4449322
commit fd137279c8
4 changed files with 9 additions and 7 deletions

View File

@ -152,8 +152,8 @@ long long DESIGN_BLOCK_IO::GetLibraryTimestamp( const wxString& aLibraryPath ) c
{
wxFileName blockDir( aLibraryPath, filename );
// Check if the directory ends with ".block", if so hash all the files in it
if( blockDir.GetFullName().EndsWith( FILEEXT::KiCadDesignBlockPathExtension ) )
// Check if the directory ends with ".kicad_block", if so hash all the files in it
ts += TimestampDir( blockDir.GetFullPath(), wxT( "*" ) );
hasMoreFiles = libDir.GetNext( &filename );
@ -260,7 +260,7 @@ void DESIGN_BLOCK_IO::DesignBlockEnumerate( wxArrayString& aDesignBlockNames,
const wxString& aLibraryPath, bool aBestEfforts,
const std::map<std::string, UTF8>* aProperties )
{
// From the starting directory, look for all directories ending in the .block extension
// From the starting directory, look for all directories ending in the .kicad_block extension
wxDir dir( aLibraryPath );
if( !dir.IsOpened() )

View File

@ -155,9 +155,11 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
wxT( "*.kicad_dru" ),
wxT( "*.kicad_wks" ),
wxT( "*.kicad_jobset" ),
wxT( "*.json" ), // for design blocks
wxT( "*.wbk" ),
wxT( "fp-lib-table" ),
wxT( "sym-lib-table" )
wxT( "sym-lib-table" ),
wxT( "design-block-lib-table" )
};
// List of additional file extensions that are only archived when aIncludeExtraFiles is true

View File

@ -187,8 +187,8 @@ const std::string FILEEXT::IpcD356FileExtension( "d356" );
const std::string FILEEXT::Ipc2581FileExtension( "xml" );
const std::string FILEEXT::WorkbookFileExtension( "wbk" );
const std::string FILEEXT::KiCadDesignBlockLibPathExtension( "blocks" ); // this is a directory
const std::string FILEEXT::KiCadDesignBlockPathExtension( "block" ); // this is a directory
const std::string FILEEXT::KiCadDesignBlockLibPathExtension( "kicad_blocks" ); // this is a directory
const std::string FILEEXT::KiCadDesignBlockPathExtension( "kicad_block" ); // this is a directory
const std::string FILEEXT::PngFileExtension( "png" );
const std::string FILEEXT::JpegFileExtension( "jpg" );
@ -555,4 +555,4 @@ wxString FILEEXT::HotkeyFileWildcard()
wxString FILEEXT::JobsetFileWildcard()
{
return _( "KiCad jobset files" ) + AddFileExtListToFilter( { KiCadJobSetFileExtension } );
}
}

View File

@ -247,7 +247,7 @@ bool SCH_EDIT_FRAME::AddDesignBlockLibrary( const wxString& aFilename,
wxString type = DESIGN_BLOCK_IO_MGR::ShowType( lib_type );
// KiCad lib is our default guess. So it might not have the .blocks extension
// KiCad lib is our default guess. So it might not have the .kicad_blocks extension
// In this case, the extension is part of the library name
if( lib_type == DESIGN_BLOCK_IO_MGR::KICAD_SEXP
&& fn.GetExt() != FILEEXT::KiCadDesignBlockLibPathExtension )