Fix %O which is broken in eeschema BOM, did not include project directory in path. Add %P which is project dir.
This commit is contained in:
parent
60bcbba585
commit
a411e4bd34
|
@ -383,7 +383,6 @@ void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
|
|||
// Calculate the xml netlist filename
|
||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||
|
||||
if( fn.GetPath().IsEmpty() )
|
||||
fn.SetPath( wxPathOnly( Prj().GetProjectFullName() ) );
|
||||
|
||||
fn.ClearExt();
|
||||
|
|
|
@ -50,6 +50,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( NETLIST_OBJECT_LIST * aConnectedItemsList
|
|||
bool executeCommandLine = false;
|
||||
|
||||
wxString fileName = aFullFileName;
|
||||
|
||||
NETLIST_EXPORTER *helper;
|
||||
|
||||
switch( aFormat )
|
||||
|
@ -93,13 +94,16 @@ bool SCH_EDIT_FRAME::WriteNetListFile( NETLIST_OBJECT_LIST * aConnectedItemsList
|
|||
if( m_netListerCommand.IsEmpty() )
|
||||
return res;
|
||||
|
||||
wxString prj_dir = Prj().GetProjectPath();
|
||||
|
||||
// build full command line from user's format string, e.g.:
|
||||
// "xsltproc -o %O /usr/local/lib/kicad/plugins/netlist_form_pads-pcb.xsl %I"
|
||||
// becomes, after the user selects /tmp/s1.net as the output file from the file dialog:
|
||||
// "xsltproc -o /tmp/s1.net /usr/local/lib/kicad/plugins/netlist_form_pads-pcb.xsl /tmp/s1.xml"
|
||||
wxString commandLine = NETLIST_EXPORTER::MakeCommandLine( m_netListerCommand,
|
||||
fileName,
|
||||
aFullFileName );
|
||||
fileName, aFullFileName,
|
||||
prj_dir.SubString( 0, prj_dir.Len() - 2 ) // strip trailing '/'
|
||||
);
|
||||
|
||||
ProcessExecute( commandLine, wxEXEC_SYNC );
|
||||
}
|
||||
|
|
|
@ -46,12 +46,13 @@
|
|||
#include <netlist_exporter.h>
|
||||
|
||||
wxString NETLIST_EXPORTER::MakeCommandLine( const wxString& aFormatString,
|
||||
const wxString& aTempfile, const wxString& aFinalFile )
|
||||
const wxString& aTempfile, const wxString& aFinalFile, const wxString& aProjectPath )
|
||||
{
|
||||
wxString ret = aFormatString;
|
||||
wxFileName in = aTempfile;
|
||||
wxFileName out = aFinalFile;
|
||||
|
||||
ret.Replace( wxT( "%P" ), aProjectPath.GetData(), true );
|
||||
ret.Replace( wxT( "%B" ), out.GetName().GetData(), true );
|
||||
ret.Replace( wxT( "%I" ), in.GetFullPath().GetData(), true );
|
||||
ret.Replace( wxT( "%O" ), out.GetFullPath().GetData(), true );
|
||||
|
@ -59,6 +60,7 @@ wxString NETLIST_EXPORTER::MakeCommandLine( const wxString& aFormatString,
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void NETLIST_EXPORTER::sprintPinNetName( wxString& aResult,
|
||||
const wxString& aNetNameFormat, NETLIST_OBJECT* aPin,
|
||||
bool aUseNetcodeAsNetName )
|
||||
|
|
|
@ -192,6 +192,8 @@ public:
|
|||
* external program.
|
||||
* @param aFinalFile is the name of an output file that
|
||||
* the user expects.
|
||||
* @param aProjectDirectory is used for %P replacement, it should omit
|
||||
* the trailing '/'.
|
||||
*
|
||||
* <p> Supported formatting sequences and their meaning:
|
||||
* <ul>
|
||||
|
@ -201,10 +203,13 @@ public:
|
|||
* input file.
|
||||
* <li> %O => complete filename and path of the user chosen
|
||||
* output file.
|
||||
* <li> %P => project directory, without name and without trailing '/'
|
||||
* </ul>
|
||||
*/
|
||||
static wxString MakeCommandLine( const wxString& aFormatString,
|
||||
const wxString& aTempfile, const wxString& aFinalFile );
|
||||
const wxString& aTempfile, const wxString& aFinalFile,
|
||||
const wxString& aProjectDirectory
|
||||
);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue