diff --git a/common/jobs/job_export_sch_plot.cpp b/common/jobs/job_export_sch_plot.cpp index ef983212c0..d1b7bac77c 100644 --- a/common/jobs/job_export_sch_plot.cpp +++ b/common/jobs/job_export_sch_plot.cpp @@ -129,8 +129,8 @@ JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) : } -JOB_EXPORT_SCH_PLOT_PDF::JOB_EXPORT_SCH_PLOT_PDF() : - JOB_EXPORT_SCH_PLOT( false ) +JOB_EXPORT_SCH_PLOT_PDF::JOB_EXPORT_SCH_PLOT_PDF( bool aOutputIsDirectory ) : + JOB_EXPORT_SCH_PLOT( aOutputIsDirectory ) { m_plotFormat = SCH_PLOT_FORMAT::PDF; } diff --git a/common/jobs/job_export_sch_plot.h b/common/jobs/job_export_sch_plot.h index b774c2f971..d878d5e8ff 100644 --- a/common/jobs/job_export_sch_plot.h +++ b/common/jobs/job_export_sch_plot.h @@ -103,7 +103,7 @@ public: class KICOMMON_API JOB_EXPORT_SCH_PLOT_PDF : public JOB_EXPORT_SCH_PLOT { public: - JOB_EXPORT_SCH_PLOT_PDF(); + JOB_EXPORT_SCH_PLOT_PDF( bool aOutputIsDirectory = true ); wxString GetDefaultDescription() const override; wxString GetSettingsDialogTitle() const override; }; diff --git a/kicad/cli/command_sch_export_plot.cpp b/kicad/cli/command_sch_export_plot.cpp index d5474c11a2..7a8e88e60d 100644 --- a/kicad/cli/command_sch_export_plot.cpp +++ b/kicad/cli/command_sch_export_plot.cpp @@ -134,6 +134,7 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName, int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway ) { wxString filename = m_argInput; + if( !wxFile::Exists( filename ) ) { wxFprintf( stderr, _( "Schematic file does not exist or is not accessible\n" ) ); @@ -143,23 +144,21 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway ) std::vector<wxString> pages; wxString pagesStr = From_UTF8( m_argParser.get<std::string>( ARG_PAGES ).c_str() ); wxStringTokenizer tokenizer( pagesStr, "," ); + while( tokenizer.HasMoreTokens() ) - { pages.push_back( tokenizer.GetNextToken().Trim() ); - } std::unique_ptr<JOB_EXPORT_SCH_PLOT> plotJob; switch( m_plotFormat ) { - case SCH_PLOT_FORMAT::PDF: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_PDF>(); break; - case SCH_PLOT_FORMAT::DXF: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_DXF>(); break; - case SCH_PLOT_FORMAT::SVG: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_SVG>(); break; - case SCH_PLOT_FORMAT::POST: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_PS>(); break; - case SCH_PLOT_FORMAT::HPGL: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_HPGL>(); break; + case SCH_PLOT_FORMAT::PDF: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_PDF>( false ); break; + case SCH_PLOT_FORMAT::DXF: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_DXF>(); break; + case SCH_PLOT_FORMAT::SVG: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_SVG>(); break; + case SCH_PLOT_FORMAT::POST: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_PS>(); break; + case SCH_PLOT_FORMAT::HPGL: plotJob = std::make_unique<JOB_EXPORT_SCH_PLOT_HPGL>(); break; } - plotJob->m_filename = filename; plotJob->m_plotFormat = m_plotFormat; plotJob->m_plotPages = pages;