← Back to team overview

kicad-developers team mailing list archive

[PATCH] fix issues reported by Chris Anon on MSWin

 

The attached patch 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.

- Cirilo
=== modified file 'pcbnew/exporters/export_idf.cpp'
--- pcbnew/exporters/export_idf.cpp	2015-01-05 21:51:47 +0000
+++ pcbnew/exporters/export_idf.cpp	2015-01-11 01:11:38 +0000
@@ -378,7 +378,7 @@
 
         IDF3_COMP_OUTLINE* outline;
 
-        outline = aIDFBoard.GetComponentOutline( modfile->GetShape3DName() );
+        outline = aIDFBoard.GetComponentOutline( modfile->GetShape3DFullFilename() );
 
         if( !outline )
             throw( std::runtime_error( aIDFBoard.GetError() ) );

=== modified file 'utils/idftools/idf_outlines.cpp'
--- utils/idftools/idf_outlines.cpp	2014-07-15 18:13:08 +0000
+++ utils/idftools/idf_outlines.cpp	2015-01-11 01:06:26 +0000
@@ -200,6 +200,9 @@
             // rewind to the start of the last line; the routine invoking
             // this is responsible for checking that the current '.END_ ...'
             // matches the section header.
+            if(aBoardFile.eof())
+                aBoardFile.clear();
+
             aBoardFile.seekg( pos );
 
             if( outlines.size() > 0 )
@@ -2998,6 +3001,9 @@
 
         if( token.size() >= 5 && CompareToken( ".END_", token.substr( 0, 5 ) ) )
         {
+            if(aLibFile.eof())
+                aLibFile.clear();
+
             aLibFile.seekg( pos );
             return;
         }

=== modified file 'utils/idftools/idf_parser.cpp'
--- utils/idftools/idf_parser.cpp	2014-11-13 11:29:05 +0000
+++ utils/idftools/idf_parser.cpp	2015-01-11 01:05:29 +0000
@@ -2306,7 +2306,7 @@
 
     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() )
         {
@@ -2682,7 +2682,7 @@
 
     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;
 
@@ -3883,7 +3883,7 @@
 
     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


Follow ups