← Back to team overview

kicad-developers team mailing list archive

% in command line is not expanded when pressing BOM icon

 

Hi

I have only the microsoft windows build and therefore not bzz or git so
I can only post the suggested  code fix directly here


If you enter a plugin with a command line looking like this

xsltproc.exe -o “%O.csv” "%P/bom_with_title_block_2_csv.xsl" “%I”


The %P is not expanded before leaving function
DIALOG_BOM::getPluginFileName in file dialog_bom.cpp

Therefore the function who called getPluginFileName fails to open it
(for example to scan and present the pageheader)

I suggest the following code should be added to the end of the function


(this is essential the same code used when the user press Generate)
	
	if (!pluginName.IsEmpty())
	{
		wxFileName  fn;
		wxString prj_dir = Prj().GetProjectPath();
	
		// Calculate the xml netlist filename
		fn = g_RootSheet->GetScreen()->GetFileName();

		fn.ClearExt();
		wxString fullfilename = fn.GetFullPath();

		// 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"
		pluginName = NETLIST_EXPORTER::MakeCommandLine( pluginName,
			fullfilename, fullfilename,
			Prj().GetProjectPath().SubString( 0, prj_dir.Len() - 2 )       //
strip trailing '/'
			);
	}
				
    return pluginName;
}





References