diff --git a/utils/kicad2step/kicad2step.cpp b/utils/kicad2step/kicad2step.cpp index fcd4e8d810..5b8c688640 100644 --- a/utils/kicad2step/kicad2step.cpp +++ b/utils/kicad2step/kicad2step.cpp @@ -267,6 +267,14 @@ int KICAD2MCAD::OnRun() tfname.SetExt( getOutputExt() ); } + if( tfname.FileExists() && !m_overwrite ) + { + std::cerr << "** Output already exists. " + << "Enable the force overwrite flag to overwrite it." << std::endl; + + return -1; + } + wxString outfile = tfname.GetFullPath(); KICADPCB pcb; @@ -289,10 +297,10 @@ int KICAD2MCAD::OnRun() #ifdef SUPPORTS_IGES if( m_fmtIGES ) - res = pcb.WriteIGES( outfile, m_overwrite ); + res = pcb.WriteIGES( outfile ); else #endif - res = pcb.WriteSTEP( outfile, m_overwrite ); + res = pcb.WriteSTEP( outfile ); if( !res ) return -1; diff --git a/utils/kicad2step/pcb/kicadpcb.cpp b/utils/kicad2step/pcb/kicadpcb.cpp index 984c810a21..4796d54e10 100644 --- a/utils/kicad2step/pcb/kicadpcb.cpp +++ b/utils/kicad2step/pcb/kicadpcb.cpp @@ -179,12 +179,12 @@ bool KICADPCB::ReadFile( const wxString& aFileName ) } -bool KICADPCB::WriteSTEP( const wxString& aFileName, bool aOverwrite ) +bool KICADPCB::WriteSTEP( const wxString& aFileName ) { if( m_pcb ) { std::string filename( aFileName.ToUTF8() ); - return m_pcb->WriteSTEP( filename, aOverwrite ); + return m_pcb->WriteSTEP( filename ); } return false; @@ -192,12 +192,12 @@ bool KICADPCB::WriteSTEP( const wxString& aFileName, bool aOverwrite ) #ifdef SUPPORTS_IGES -bool KICADPCB::WriteIGES( const wxString& aFileName, bool aOverwrite ) +bool KICADPCB::WriteIGES( const wxString& aFileName ) { if( m_pcb ) { std::string filename( aFileName.ToUTF8() ); - return m_pcb->WriteIGES( filename, aOverwrite ); + return m_pcb->WriteIGES( filename ); } return false; diff --git a/utils/kicad2step/pcb/kicadpcb.h b/utils/kicad2step/pcb/kicadpcb.h index 63310a0f04..f754b30ca1 100644 --- a/utils/kicad2step/pcb/kicadpcb.h +++ b/utils/kicad2step/pcb/kicadpcb.h @@ -108,9 +108,9 @@ public: bool ReadFile( const wxString& aFileName ); bool ComposePCB( bool aComposeVirtual = true ); - bool WriteSTEP( const wxString& aFileName, bool aOverwrite ); + bool WriteSTEP( const wxString& aFileName ); #ifdef SUPPORTS_IGES - bool WriteIGES( const wxString& aFileName, bool aOverwrite ); + bool WriteIGES( const wxString& aFileName ); #endif }; diff --git a/utils/kicad2step/pcb/oce_utils.cpp b/utils/kicad2step/pcb/oce_utils.cpp index d19a2873d7..3ee8529c08 100644 --- a/utils/kicad2step/pcb/oce_utils.cpp +++ b/utils/kicad2step/pcb/oce_utils.cpp @@ -838,7 +838,7 @@ bool PCBMODEL::CreatePCB() #ifdef SUPPORTS_IGES // write the assembly model in IGES format -bool PCBMODEL::WriteIGES( const std::string& aFileName, bool aOverwrite ) +bool PCBMODEL::WriteIGES( const std::string& aFileName ) { if( m_pcb_label.IsNull() ) { @@ -872,7 +872,7 @@ bool PCBMODEL::WriteIGES( const std::string& aFileName, bool aOverwrite ) // write the assembly model in STEP format -bool PCBMODEL::WriteSTEP( const std::string& aFileName, bool aOverwrite ) +bool PCBMODEL::WriteSTEP( const std::string& aFileName ) { if( m_pcb_label.IsNull() ) { diff --git a/utils/kicad2step/pcb/oce_utils.h b/utils/kicad2step/pcb/oce_utils.h index c4585d88d6..709d02574c 100644 --- a/utils/kicad2step/pcb/oce_utils.h +++ b/utils/kicad2step/pcb/oce_utils.h @@ -142,11 +142,11 @@ public: #ifdef SUPPORTS_IGES // write the assembly model in IGES format - bool WriteIGES( const std::string& aFileName, bool aOverwrite ); + bool WriteIGES( const std::string& aFileName ); #endif // write the assembly model in STEP format - bool WriteSTEP( const std::string& aFileName, bool aOverwrite ); + bool WriteSTEP( const std::string& aFileName ); }; #endif //OCE_VIS_OCE_UTILS_H