Commit b269128b authored by unknown's avatar unknown Committed by jean-pierre charras

Fixes issues with IDF file I/O on Windows (the famous 'ascii vs. binary'...

Fixes issues with IDF file I/O on Windows (the famous 'ascii vs. binary' issue) and the reported problem of partial paths when KISYS3DMOD is specified.
parent 960ea566
...@@ -378,7 +378,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule, ...@@ -378,7 +378,7 @@ static void idf_export_module( BOARD* aPcb, MODULE* aModule,
IDF3_COMP_OUTLINE* outline; IDF3_COMP_OUTLINE* outline;
outline = aIDFBoard.GetComponentOutline( modfile->GetShape3DName() ); outline = aIDFBoard.GetComponentOutline( modfile->GetShape3DFullFilename() );
if( !outline ) if( !outline )
throw( std::runtime_error( aIDFBoard.GetError() ) ); throw( std::runtime_error( aIDFBoard.GetError() ) );
......
...@@ -200,6 +200,9 @@ void BOARD_OUTLINE::readOutlines( std::ifstream& aBoardFile, IDF3::IDF_VERSION a ...@@ -200,6 +200,9 @@ void BOARD_OUTLINE::readOutlines( std::ifstream& aBoardFile, IDF3::IDF_VERSION a
// rewind to the start of the last line; the routine invoking // rewind to the start of the last line; the routine invoking
// this is responsible for checking that the current '.END_ ...' // this is responsible for checking that the current '.END_ ...'
// matches the section header. // matches the section header.
if(aBoardFile.eof())
aBoardFile.clear();
aBoardFile.seekg( pos ); aBoardFile.seekg( pos );
if( outlines.size() > 0 ) if( outlines.size() > 0 )
...@@ -2998,6 +3001,9 @@ void IDF3_COMP_OUTLINE::readProperties( std::ifstream& aLibFile ) ...@@ -2998,6 +3001,9 @@ void IDF3_COMP_OUTLINE::readProperties( std::ifstream& aLibFile )
if( token.size() >= 5 && CompareToken( ".END_", token.substr( 0, 5 ) ) ) if( token.size() >= 5 && CompareToken( ".END_", token.substr( 0, 5 ) ) )
{ {
if(aLibFile.eof())
aLibFile.clear();
aLibFile.seekg( pos ); aLibFile.seekg( pos );
return; return;
} }
......
...@@ -2306,7 +2306,7 @@ void IDF3_BOARD::readBoardFile( const std::string& aFileName, bool aNoSubstitute ...@@ -2306,7 +2306,7 @@ void IDF3_BOARD::readBoardFile( const std::string& aFileName, bool aNoSubstitute
try try
{ {
brd.open( aFileName.c_str(), std::ios_base::in ); brd.open( aFileName.c_str(), std::ios_base::in | std::ios_base::binary );
if( !brd.is_open() ) if( !brd.is_open() )
{ {
...@@ -2682,7 +2682,7 @@ void IDF3_BOARD::readLibFile( const std::string& aFileName ) ...@@ -2682,7 +2682,7 @@ void IDF3_BOARD::readLibFile( const std::string& aFileName )
try try
{ {
lib.open( aFileName.c_str(), std::ios_base::in ); lib.open( aFileName.c_str(), std::ios_base::in | std::ios_base::binary );
IDF3::FILE_STATE state = IDF3::FILE_START; IDF3::FILE_STATE state = IDF3::FILE_START;
...@@ -3883,7 +3883,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( wxString aFullFileName ) ...@@ -3883,7 +3883,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( wxString aFullFileName )
try try
{ {
model.open( fname.c_str(), std::ios_base::in ); model.open( fname.c_str(), std::ios_base::in | std::ios_base::binary );
std::string iline; // the input line std::string iline; // the input line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment