Fix UTF8 filename issues in kicad2step
This commit is contained in:
parent
ccfad8306b
commit
960c139064
|
@ -1,13 +1,14 @@
|
|||
include_directories( BEFORE
|
||||
pcb
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
pcb
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
include_directories( SYSTEM
|
||||
${OCE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_executable( kicad2step
|
||||
set( K2S_FILES
|
||||
kicad2step.cpp
|
||||
pcb/3d_resolver.cpp
|
||||
pcb/base.cpp
|
||||
|
@ -21,6 +22,12 @@ add_executable( kicad2step
|
|||
sexpr/sexpr_parser.cpp
|
||||
)
|
||||
|
||||
if( MINGW )
|
||||
list( APPEND K2S_FILES ${CMAKE_SOURCE_DIR}/common/streamwrapper.cpp )
|
||||
endif( MINGW )
|
||||
|
||||
add_executable( kicad2step ${K2S_FILES} )
|
||||
|
||||
target_link_libraries( kicad2step ${wxWidgets_LIBRARIES} ${LIBS_OCE} )
|
||||
|
||||
if( APPLE )
|
||||
|
|
|
@ -360,7 +360,8 @@ bool KICADMODULE::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver,
|
|||
|
||||
for( auto i : m_models )
|
||||
{
|
||||
std::string fname( resolver->ResolvePath( i->m_modelname.c_str() ).ToUTF8() );
|
||||
std::string fname( resolver->ResolvePath(
|
||||
wxString::FromUTF8Unchecked( i->m_modelname.c_str() ) ).ToUTF8() );
|
||||
|
||||
if( aPCB->AddComponent( fname, m_refdes, LAYER_BOTTOM == m_side ? true : false,
|
||||
newpos, m_rotation, i->m_offset, i->m_rotation ) )
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "oce_utils.h"
|
||||
#include "kicadpad.h"
|
||||
#include "streamwrapper.h"
|
||||
|
||||
#include <IGESCAFControl_Reader.hxx>
|
||||
#include <IGESCAFControl_Writer.hxx>
|
||||
|
@ -153,7 +154,7 @@ enum FormatType
|
|||
|
||||
FormatType fileType( const char* aFileName )
|
||||
{
|
||||
wxFileName lfile( aFileName );
|
||||
wxFileName lfile( wxString::FromUTF8Unchecked( aFileName ) );
|
||||
|
||||
if( !lfile.FileExists() )
|
||||
{
|
||||
|
@ -172,16 +173,15 @@ FormatType fileType( const char* aFileName )
|
|||
else if( ext == "emn" || ext == "EMN" )
|
||||
return FMT_EMN; // PCB assembly
|
||||
|
||||
std::ifstream ifile;
|
||||
ifile.open( aFileName );
|
||||
OPEN_ISTREAM( ifile, aFileName );
|
||||
|
||||
if( !ifile.is_open() )
|
||||
if( ifile.fail() )
|
||||
return FMT_NONE;
|
||||
|
||||
char iline[82];
|
||||
memset( iline, 0, 82 );
|
||||
ifile.getline( iline, 82 );
|
||||
ifile.close();
|
||||
CLOSE_STREAM( ifile );
|
||||
iline[81] = 0; // ensure NULL termination when string is too long
|
||||
|
||||
// check for STEP in Part 21 format
|
||||
|
|
Loading…
Reference in New Issue