diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp index 6d6723493e..490133e80c 100644 --- a/eeschema/dialogs/dialog_bom.cpp +++ b/eeschema/dialogs/dialog_bom.cpp @@ -558,6 +558,14 @@ wxString DIALOG_BOM::getPluginFileName( const wxString& aCommand ) } } + // Using a format like %P is possible in plugin name, so expand it + wxString prj_dir = Prj().GetProjectPath(); + + if( prj_dir.EndsWith( '/' ) || prj_dir.EndsWith( '\\' ) ) + prj_dir.RemoveLast(); + + pluginName.Replace( wxT( "%P" ), prj_dir.GetData(), true ); + return pluginName; } diff --git a/eeschema/dialogs/dialog_bom_help.html b/eeschema/dialogs/dialog_bom_help.html index 16fd44a2f7..a254d88421 100644 --- a/eeschema/dialogs/dialog_bom_help.html +++ b/eeschema/dialogs/dialog_bom_help.html @@ -158,7 +158,7 @@ a Python script is used, the command line is something like (depending on the Python script):</font></font></p> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><i>python</i> -<i>f:/kicad\bin/plugins/bom-in-python/myconverter.py</i> +<i>f:/kicad/bin/plugins/bom-in-python/myconverter.py</i> “<i>%I”“%O”<br>or<br>python</i> <i>/usr/local/kicad/bin/plugins/bom-in-python/myconverter .xsl “%I” “%O” </i></font></font> @@ -173,8 +173,7 @@ supported formatting parameters are.</font></font></p> <li/> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>%B</b> - => base filename and path of selected output file, minus path and - extension.</font></font></p> + => base filename of selected output file, minus path and extension.</font></font></p> <li/> <p lang="en-US" class="western" style="margin-bottom: 0cm; widows: 0; orphans: 0"> <font face="Times New Roman, serif"><font size="3" style="font-size: 12pt"><b>%P</b> @@ -280,4 +279,4 @@ python is installed on your PC, and python scripts are located in </p> </body> -</html> \ No newline at end of file +</html> diff --git a/eeschema/netlist_exporters/netlist_exporter.cpp b/eeschema/netlist_exporters/netlist_exporter.cpp index fd38470526..206c793305 100644 --- a/eeschema/netlist_exporters/netlist_exporter.cpp +++ b/eeschema/netlist_exporters/netlist_exporter.cpp @@ -50,6 +50,12 @@ wxString NETLIST_EXPORTER::MakeCommandLine( const wxString& aFormatString, const wxString& aTempfile, const wxString& aFinalFile, const wxString& aProjectPath ) { + // Expand format symbols in the command line: + // %B => base filename of selected output file, minus path and extension. + // %P => project directory name, without trailing '/' or '\'. + // %I => full filename of the input file (the intermediate net file). + // %O => complete filename and path (but without extension) of the user chosen output file. + wxString ret = aFormatString; wxFileName in = aTempfile; wxFileName out = aFinalFile;