mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 08:41:41 +00:00
Ensure mkdir with bom export job
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19520
This commit is contained in:
parent
018af2b6cd
commit
fdfeda7b72
@ -428,9 +428,9 @@ bool PATHS::EnsurePathExists( const wxString& aPath )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !wxFileName::DirExists( aPath ) )
|
||||
if( !wxFileName::DirExists( path.GetPath() ) )
|
||||
{
|
||||
if( !wxFileName::Mkdir( aPath, wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
|
||||
if( !wxFileName::Mkdir( path.GetPath(), wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
|
||||
m_job->m_PDFMetadata = m_plotPDFMetadata->GetValue();
|
||||
m_job->m_plotDrawingSheet = m_plotDrawingSheet->GetValue();
|
||||
m_job->m_plotAll = true;
|
||||
m_job->m_filename = m_outputDirectoryName->GetValue();
|
||||
m_job->SetOutputPath( m_outputDirectoryName->GetValue() );
|
||||
|
||||
m_job->m_HPGLPlotOrigin =
|
||||
static_cast<JOB_HPGL_PLOT_ORIGIN_AND_UNITS>( m_plotOriginOpt->GetSelection() );
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <plotters/plotters_pslike.h>
|
||||
#include <drawing_sheet/ds_data_model.h>
|
||||
#include <paths.h>
|
||||
#include <reporter.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
@ -333,6 +334,12 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
|
||||
case JOB_PAGE_SIZE::PAGE_SIZE_AUTO: pageSizeSelect = PageFormatReq::PAGE_SIZE_AUTO; break;
|
||||
}
|
||||
|
||||
if( !PATHS::EnsurePathExists( aPlotJob->GetFullOutputPath() ) )
|
||||
{
|
||||
m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||
}
|
||||
|
||||
SCH_PLOT_OPTS plotOpts;
|
||||
plotOpts.m_blackAndWhite = aPlotJob->m_blackAndWhite;
|
||||
plotOpts.m_HPGLPaperSizeSelect = hpglPageSize;
|
||||
@ -463,6 +470,12 @@ int EESCHEMA_JOBS_HANDLER::JobExportNetlist( JOB* aJob )
|
||||
aNetJob->SetOutputPath( fn.GetFullName() );
|
||||
}
|
||||
|
||||
if( !PATHS::EnsurePathExists( aNetJob->GetFullOutputPath() ) )
|
||||
{
|
||||
m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||
}
|
||||
|
||||
bool res = helper->WriteNetlist( aNetJob->GetFullOutputPath(), netlistOption, *m_reporter );
|
||||
|
||||
if( !res )
|
||||
@ -664,6 +677,12 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
|
||||
aBomJob->SetOutputPath( fn.GetFullName() );
|
||||
}
|
||||
|
||||
if( !PATHS::EnsurePathExists( aBomJob->GetFullOutputPath() ) )
|
||||
{
|
||||
m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||
}
|
||||
|
||||
wxFile f;
|
||||
|
||||
if( !f.Open( aBomJob->GetFullOutputPath(), wxFile::write ) )
|
||||
@ -777,6 +796,12 @@ int EESCHEMA_JOBS_HANDLER::JobExportPythonBom( JOB* aJob )
|
||||
aNetJob->SetOutputPath( fn.GetFullName() );
|
||||
}
|
||||
|
||||
if( !PATHS::EnsurePathExists( aNetJob->GetFullOutputPath() ) )
|
||||
{
|
||||
m_reporter->Report( _( "Failed to create output directory\n" ), RPT_SEVERITY_ERROR );
|
||||
return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
|
||||
}
|
||||
|
||||
bool res = xmlNetlist->WriteNetlist( aNetJob->GetFullOutputPath(), GNL_OPT_BOM, *m_reporter );
|
||||
|
||||
if( !res )
|
||||
|
Loading…
Reference in New Issue
Block a user