mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 19:43:44 +00:00
Add more global extensions and switch archiver to use them
This commit is contained in:
parent
5268217e72
commit
6be3401b92
common
eeschema
include
kicad/tools
pcbnew
@ -56,9 +56,6 @@ DESIGN_BLOCK_LIST_IMPL GDesignBlockList;
|
||||
using namespace LIB_TABLE_T;
|
||||
|
||||
|
||||
static const wxChar global_tbl_name[] = wxT( "design-block-lib-table" );
|
||||
|
||||
|
||||
bool DESIGN_BLOCK_LIB_TABLE_ROW::operator==( const DESIGN_BLOCK_LIB_TABLE_ROW& aRow ) const
|
||||
{
|
||||
return LIB_TABLE_ROW::operator==( aRow ) && type == aRow.type;
|
||||
@ -612,7 +609,7 @@ bool DESIGN_BLOCK_LIB_TABLE::LoadGlobalTable( DESIGN_BLOCK_LIB_TABLE& aTable )
|
||||
if( v && !v->IsEmpty() )
|
||||
ss.AddPaths( *v, 0 );
|
||||
|
||||
wxString fileName = ss.FindValidPath( global_tbl_name );
|
||||
wxString fileName = ss.FindValidPath( FILEEXT::DesignBlockLibraryTableFileName );
|
||||
|
||||
// The fallback is to create an empty global design block table for the user to populate.
|
||||
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
|
||||
@ -691,7 +688,7 @@ wxString DESIGN_BLOCK_LIB_TABLE::GetGlobalTableFileName()
|
||||
wxFileName fn;
|
||||
|
||||
fn.SetPath( PATHS::GetUserSettingsPath() );
|
||||
fn.SetName( global_tbl_name );
|
||||
fn.SetName( FILEEXT::DesignBlockLibraryTableFileName );
|
||||
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
@ -46,9 +46,6 @@
|
||||
using namespace LIB_TABLE_T;
|
||||
|
||||
|
||||
static const wxChar global_tbl_name[] = wxT( "fp-lib-table" );
|
||||
|
||||
|
||||
bool FP_LIB_TABLE_ROW::operator==( const FP_LIB_TABLE_ROW& aRow ) const
|
||||
{
|
||||
return LIB_TABLE_ROW::operator == ( aRow ) && type == aRow.type;
|
||||
@ -608,7 +605,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
|
||||
if( v && !v->IsEmpty() )
|
||||
ss.AddPaths( *v, 0 );
|
||||
|
||||
wxString fileName = ss.FindValidPath( global_tbl_name );
|
||||
wxString fileName = ss.FindValidPath( FILEEXT::FootprintLibraryTableFileName );
|
||||
|
||||
// The fallback is to create an empty global footprint table for the user to populate.
|
||||
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
|
||||
@ -673,7 +670,7 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
|
||||
wxFileName fn;
|
||||
|
||||
fn.SetPath( PATHS::GetUserSettingsPath() );
|
||||
fn.SetName( global_tbl_name );
|
||||
fn.SetName( FILEEXT::FootprintLibraryTableFileName );
|
||||
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
@ -158,19 +158,19 @@ bool PROJECT::IsNullProject() const
|
||||
|
||||
const wxString PROJECT::SymbolLibTableName() const
|
||||
{
|
||||
return libTableName( wxS( "sym-lib-table" ) );
|
||||
return libTableName( FILEEXT::SymbolLibraryTableFileName );
|
||||
}
|
||||
|
||||
|
||||
const wxString PROJECT::FootprintLibTblName() const
|
||||
{
|
||||
return libTableName( wxS( "fp-lib-table" ) );
|
||||
return libTableName( FILEEXT::FootprintLibraryTableFileName );
|
||||
}
|
||||
|
||||
|
||||
const wxString PROJECT::DesignBlockLibTblName() const
|
||||
{
|
||||
return libTableName( wxS( "design-block-lib-table" ) );
|
||||
return libTableName( FILEEXT::DesignBlockLibraryTableFileName );
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,8 +174,8 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
|
||||
{
|
||||
|
||||
#define EXT( ext ) "\\." + ext + "|"
|
||||
#define NAME( name ) name "|"
|
||||
#define EXT_NO_PIPE( ext ) "\\." ext
|
||||
#define NAME( name ) name + "|"
|
||||
#define EXT_NO_PIPE( ext ) "\\." + ext
|
||||
#define NAME_NO_PIPE( name ) name
|
||||
|
||||
// List of file extensions that are always archived
|
||||
@ -190,10 +190,10 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
|
||||
EXT( FILEEXT::DrawingSheetFileExtension )
|
||||
EXT( FILEEXT::KiCadJobSetFileExtension )
|
||||
EXT( FILEEXT::JsonFileExtension ) // for design blocks
|
||||
EXT( FILEEXT::WorkbookFileExtension )
|
||||
NAME( "fp-lib-table" )
|
||||
NAME( "sym-lib-table" )
|
||||
NAME_NO_PIPE( "design-block-lib-table" );
|
||||
EXT( FILEEXT::WorkbookFileExtension ) +
|
||||
NAME( FILEEXT::FootprintLibraryTableFileName ) +
|
||||
NAME( FILEEXT::SymbolLibraryTableFileName ) +
|
||||
NAME_NO_PIPE( FILEEXT::DesignBlockLibraryTableFileName );
|
||||
|
||||
// List of additional file extensions that are only archived when aIncludeExtraFiles is true
|
||||
if( aIncludeExtraFiles )
|
||||
@ -217,14 +217,14 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
|
||||
EXT( "xnc" ) // Fab drill files
|
||||
EXT( FILEEXT::IpcD356FileExtension )
|
||||
EXT( FILEEXT::ReportFileExtension )
|
||||
EXT( "net" )
|
||||
EXT( "py" )
|
||||
EXT( FILEEXT::NetlistFileExtension )
|
||||
EXT( FILEEXT::PythonFileExtension )
|
||||
EXT( FILEEXT::PdfFileExtension )
|
||||
EXT( FILEEXT::TextFileExtension )
|
||||
EXT( FILEEXT::SpiceFileExtension ) // SPICE files
|
||||
EXT( "sub" ) // SPICE files
|
||||
EXT( "model" ) // SPICE files
|
||||
EXT_NO_PIPE( "ibs" );
|
||||
EXT( FILEEXT::SpiceSubcircuitFileExtension ) // SPICE files
|
||||
EXT( FILEEXT::SpiceModelFileExtension ) // SPICE files
|
||||
EXT_NO_PIPE( FILEEXT::IbisFileExtension );
|
||||
}
|
||||
|
||||
fileExtensionRegex += ")";
|
||||
@ -276,7 +276,7 @@ bool PROJECT_ARCHIVER::Archive( const wxString& aSrcDir, const wxString& aDestFi
|
||||
|
||||
for( unsigned ii = 0; ii < files.GetCount(); ++ii )
|
||||
{
|
||||
if( files[ii].EndsWith( wxS( ".ibs" ) ) )
|
||||
if( files[ii].EndsWith( FILEEXT::IbisFileExtension ) )
|
||||
{
|
||||
wxFileName package( files[ ii ] );
|
||||
package.MakeRelativeTo( aSrcDir );
|
||||
|
@ -484,8 +484,8 @@ public:
|
||||
{
|
||||
wxFileName file( aSrcFilePath );
|
||||
|
||||
if( !m_migrateTables && ( file.GetName() == wxT( "sym-lib-table" ) ||
|
||||
file.GetName() == wxT( "fp-lib-table" ) ) )
|
||||
if( !m_migrateTables && ( file.GetName() == FILEEXT::SymbolLibraryTableFileName ||
|
||||
file.GetName() == FILEEXT::FootprintLibraryTableFileName ) )
|
||||
{
|
||||
return wxDIR_CONTINUE;
|
||||
}
|
||||
|
@ -142,6 +142,9 @@ const std::string FILEEXT::CadstarSchematicFileExtension( "csa" );
|
||||
const std::string FILEEXT::CadstarPartsLibraryFileExtension( "lib" );
|
||||
const std::string FILEEXT::KiCadSchematicFileExtension( "kicad_sch" );
|
||||
const std::string FILEEXT::SpiceFileExtension( "cir" );
|
||||
const std::string FILEEXT::SpiceModelFileExtension( "model" );
|
||||
const std::string FILEEXT::SpiceSubcircuitFileExtension( "sub" );
|
||||
const std::string FILEEXT::IbisFileExtension( "ibs" );
|
||||
const std::string FILEEXT::CadstarNetlistFileExtension( "frp" );
|
||||
const std::string FILEEXT::OrCadPcb2NetlistFileExtension( "net" );
|
||||
const std::string FILEEXT::NetlistFileExtension( "net" );
|
||||
@ -197,6 +200,7 @@ const std::string FILEEXT::MarkdownFileExtension( "md" );
|
||||
const std::string FILEEXT::CsvFileExtension( "csv" );
|
||||
const std::string FILEEXT::XmlFileExtension( "xml" );
|
||||
const std::string FILEEXT::JsonFileExtension( "json" );
|
||||
const std::string FILEEXT::PythonFileExtension( "py" );
|
||||
|
||||
const std::string FILEEXT::StepFileExtension( "step" );
|
||||
const std::string FILEEXT::StepFileAbrvExtension( "stp" );
|
||||
@ -208,6 +212,10 @@ const std::string FILEEXT::StlFileExtension( "stl" );
|
||||
|
||||
const wxString FILEEXT::GerberFileExtensionsRegex( "(gbr|gko|pho|(g[tb][alops])|(gm?\\d\\d*)|(gp[tb]))" );
|
||||
|
||||
const std::string FILEEXT::FootprintLibraryTableFileName( "fp-lib-table" );
|
||||
const std::string FILEEXT::SymbolLibraryTableFileName( "sym-lib-table" );
|
||||
const std::string FILEEXT::DesignBlockLibraryTableFileName( "design-block-lib-table" );
|
||||
|
||||
const std::string FILEEXT::KiCadUriPrefix( "kicad-embed" );
|
||||
|
||||
|
||||
|
@ -643,7 +643,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
|
||||
aErrors += msg;
|
||||
}
|
||||
}
|
||||
else if( destFile.GetName() == wxS( "sym-lib-table" ) )
|
||||
else if( destFile.GetName() == FILEEXT::SymbolLibraryTableFileName )
|
||||
{
|
||||
SYMBOL_LIB_TABLE symbolLibTable;
|
||||
symbolLibTable.Load( aSrcFilePath );
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <sim/sim_library.h>
|
||||
#include <sim/sim_library_spice.h>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <macros.h>
|
||||
|
||||
|
||||
@ -35,7 +36,7 @@ SIM_LIBRARY::Create( const wxString& aFilePath, bool aForceFullParse, REPORTER&
|
||||
{
|
||||
std::unique_ptr<SIM_LIBRARY> library;
|
||||
|
||||
if( aFilePath.EndsWith( ".ibs" ) )
|
||||
if( aFilePath.EndsWith( FILEEXT::IbisFileExtension ) )
|
||||
library = std::make_unique<SIM_LIBRARY_IBIS>();
|
||||
else
|
||||
library = std::make_unique<SIM_LIBRARY_SPICE>( aForceFullParse );
|
||||
|
@ -45,10 +45,6 @@
|
||||
|
||||
using namespace LIB_TABLE_T;
|
||||
|
||||
|
||||
static const wxString global_tbl_name( "sym-lib-table" );
|
||||
|
||||
|
||||
const char* SYMBOL_LIB_TABLE::PropPowerSymsOnly = "pwr_sym_only";
|
||||
const char* SYMBOL_LIB_TABLE::PropNonPowerSymsOnly = "non_pwr_sym_only";
|
||||
int SYMBOL_LIB_TABLE::m_modifyHash = 1; // starts at 1 and goes up
|
||||
@ -651,7 +647,7 @@ bool SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE& aTable )
|
||||
if( v && !v->IsEmpty() )
|
||||
ss.AddPaths( *v, 0 );
|
||||
|
||||
wxString fileName = ss.FindValidPath( global_tbl_name );
|
||||
wxString fileName = ss.FindValidPath( FILEEXT::SymbolLibraryTableFileName );
|
||||
|
||||
// The fallback is to create an empty global symbol table for the user to populate.
|
||||
if( fileName.IsEmpty() || !::wxCopyFile( fileName, fn.GetFullPath(), false ) )
|
||||
@ -743,13 +739,13 @@ wxString SYMBOL_LIB_TABLE::GetGlobalTableFileName()
|
||||
wxFileName fn;
|
||||
|
||||
fn.SetPath( PATHS::GetUserSettingsPath() );
|
||||
fn.SetName( global_tbl_name );
|
||||
fn.SetName( FILEEXT::SymbolLibraryTableFileName );
|
||||
|
||||
return fn.GetFullPath();
|
||||
}
|
||||
|
||||
|
||||
const wxString& SYMBOL_LIB_TABLE::GetSymbolLibTableFileName()
|
||||
const wxString SYMBOL_LIB_TABLE::GetSymbolLibTableFileName()
|
||||
{
|
||||
return global_tbl_name;
|
||||
return FILEEXT::SymbolLibraryTableFileName;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ public:
|
||||
|
||||
static SYMBOL_LIB_TABLE& GetGlobalLibTable();
|
||||
|
||||
static const wxString& GetSymbolLibTableFileName();
|
||||
static const wxString GetSymbolLibTableFileName();
|
||||
|
||||
/**
|
||||
* Compares this table against another.
|
||||
|
@ -131,7 +131,10 @@ public:
|
||||
static const std::string CadstarSchematicFileExtension;
|
||||
static const std::string CadstarPartsLibraryFileExtension;
|
||||
static const std::string KiCadSchematicFileExtension;
|
||||
static const std::string IbisFileExtension;
|
||||
static const std::string SpiceFileExtension;
|
||||
static const std::string SpiceModelFileExtension;
|
||||
static const std::string SpiceSubcircuitFileExtension;
|
||||
static const std::string CadstarNetlistFileExtension;
|
||||
static const std::string OrCadPcb2NetlistFileExtension;
|
||||
static const std::string NetlistFileExtension;
|
||||
@ -186,6 +189,7 @@ public:
|
||||
static const std::string CsvFileExtension;
|
||||
static const std::string XmlFileExtension;
|
||||
static const std::string JsonFileExtension;
|
||||
static const std::string PythonFileExtension;
|
||||
|
||||
static const std::string StepFileExtension;
|
||||
static const std::string StepFileAbrvExtension;
|
||||
@ -199,6 +203,10 @@ public:
|
||||
|
||||
static const wxString GerberFileExtensionsRegex;
|
||||
|
||||
static const std::string FootprintLibraryTableFileName;
|
||||
static const std::string SymbolLibraryTableFileName;
|
||||
static const std::string DesignBlockLibraryTableFileName;
|
||||
|
||||
static const std::string KiCadUriPrefix;
|
||||
|
||||
/**
|
||||
|
@ -533,7 +533,7 @@ public:
|
||||
|| ext == FILEEXT::LegacySymbolDocumentFileExtension
|
||||
|| ext == FILEEXT::KiCadSymbolLibFileExtension
|
||||
|| ext == FILEEXT::NetlistFileExtension
|
||||
|| destFile.GetName() == "sym-lib-table" )
|
||||
|| destFile.GetName() == FILEEXT::SymbolLibraryTableFileName )
|
||||
{
|
||||
KIFACE* eeschema = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH );
|
||||
eeschema->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
|
||||
@ -545,7 +545,7 @@ public:
|
||||
|| ext == FILEEXT::KiCadFootprintFileExtension
|
||||
|| ext == FILEEXT::LegacyFootprintLibPathExtension
|
||||
|| ext == FILEEXT::FootprintAssignmentFileExtension
|
||||
|| destFile.GetName() == "fp-lib-table" )
|
||||
|| destFile.GetName() == FILEEXT::FootprintLibraryTableFileName )
|
||||
{
|
||||
KIFACE* pcbnew = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
|
||||
pcbnew->SaveFileAs( m_projectDirPath, m_projectName, m_newProjectDirPath,
|
||||
|
@ -547,7 +547,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcPr
|
||||
// name.
|
||||
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
||||
}
|
||||
else if( destFile.GetName() == wxT( "fp-lib-table" ) )
|
||||
else if( destFile.GetName() == FILEEXT::FootprintLibraryTableFileName )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user