From 23676eb98878eb458fac65a9551a31f0d45fc0fb Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 6 Nov 2023 21:11:35 -0500 Subject: [PATCH] Ensure output directory exists for drill files cli export --- pcbnew/pcbnew_jobs_handler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index 32a33fa9ca..764516e065 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -536,6 +536,14 @@ int PCBNEW_JOBS_HANDLER::JobExportDrill( JOB* aJob ) BOARD* brd = LoadBoard( aDrillJob->m_filename ); + // ensure output dir exists + wxFileName fn( aDrillJob->m_outputDir + wxT( "/" ) ); + if( !fn.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) ) + { + m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR ); + return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT; + } + std::unique_ptr drillWriter; if( aDrillJob->m_format == JOB_EXPORT_PCB_DRILL::DRILL_FORMAT::EXCELLON )